Send
POST /:account/messages
A Message can be sent to multiple recipients at the same time by listing each recipient number in the to
field.
Examples
Sending a Message
Request
POST /my_account/messages
Body
{
"to": "+13035551234",
"body": "New phone who dis?"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/messages
-d '{
"to": "+13035551234",
"body": "New phone who dis?"
}'
Response
Status
201
Response Type
Example Body
{
"@type": "Message",
"id": "/messages/QNDkpL",
"@context": "/contexts/Message.jsonld",
"direction": "out",
"body": "Chuck Norris doesn't use web standards as the web will conform to him.",
"formattedBody": "<div>Chuck Norris doesn't use web standards as the web will conform to him.</div>",
"displayTimestamp": "2018-07-24T20:59:32.156Z",
"timelinePosition": "2018-07-24T20:59:32.156Z",
"deliveryState": "delivered",
"conversation": "/conversations/kY1QwY",
"sender": "/users/hikvlD",
"attachments": {
"@context": "/contexts/hydra:Collection.jsonld",
"@type": "hydra:Collection",
"id": "/messages/joZqVWd/attachments",
"members": [],
"totalItems": 0
},
"friendlyStateDescription": "Message Delivered",
"retryAllowed": false,
"retry": null,
"latestEventAt": "2018-07-24T20:59:32.156Z",
"flags": [],
"source": "textus"
}
Sending a Message to multiple Recipients
Request
POST /my_account/messages
Body
{
"to": ["+13035551234", "+13035555678"],
"body": "New phone who dis?"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/messages
-d '{
"to": ["+13035551234", "+13035555678"],
"body": "New phone who dis?"
}'
Response
Status
202
Response Type
No body
Sending a Message from a SavedReply
Request
POST /my_account/messages
Body
{
"to": ["+13035551234"],
"body": "New phone who dis?",
"saved_reply": "/saved_replies/QxvonQv"
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/messages
-d '{
"to": ["+13035551234"],
"body": "New phone who dis?",
"saved_reply": "/saved_replies/QxvonQv"
}'
Response
Status
201
Response Type
No body
Composing a single message with a custom field
Request
POST /my_account/messages
Body
{
"to": "+13035551234",
"body": "Check out my availability at "
}
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
-H Authorization:"Bearer {token}" \
-X POST /my_account/messages
-d '{
"to": "+13035551234",
"body": "Check out my availability at "
}'
Response
Status
201
Response Type
Example Body
{
"@type": "Message",
"id": "/messages/QNDkpL",
"@context": "/contexts/Message.jsonld",
"direction": "out",
"body": "Check out my availability at https://calend.ly/chuck-norris",
"formattedBody": "<div>Chuck Norris doesn't use web standards as the web will conform to him.</div>",
"displayTimestamp": "2018-07-24T20:59:32.156Z",
"timelinePosition": "2018-07-24T20:59:32.156Z",
"deliveryState": "delivered",
"conversation": "/conversations/kY1QwY",
"sender": "/users/hikvlD",
"attachments": {
"@context": "/contexts/hydra:Collection.jsonld",
"@type": "hydra:Collection",
"id": "/messages/joZqVWd/attachments",
"members": [],
"totalItems": 0
},
"friendlyStateDescription": "Message Delivered",
"retryAllowed": false,
"retry": null,
"latestEventAt": "2018-07-24T20:59:32.156Z",
"flags": [],
"source": "textus"
}