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
Sending a message with attachments
There are limitations to sending an attachment. The attachment has to be under 525KB. You can only send one attachment per request. The media_url must be a public url to the file you want to attach, and you must include the mime type as the value of the content_type property. Current supported file types are as follows: .png, .jpg/.jpeg, .gif, .rtf, .pdf, .ics, and .vcf/.vcard
Request
POST /my_account/messages
Body
{
"to": ["+13035551234"],
"body": "New phone who dis?",
"attachments": [{ "media_url": "https://example.com/example.png", "content_type": "image/png" }]
}
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?",
"attachments": [{ "media_url": "https://example.com/example.png", "content_type": "image/png" }]
}'
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": [
{
"@type": "Attachment",
"@context": "/contexts/Attachment.jsonld",
"id": "/attachments/JYngGL",
"url": "https://some_url.com",
"downloadUrl": "https://s3.amazonaws.com/some_url",
"key": "251fea5fce73d0d287e0db77fc2981fe6d01f09a37919ee6e1851c7fd1c2487b.png",
"contentType": "image/png",
"size": 2697,
"width": 300,
"height": 300,
"originalFilename": null
}
],
"totalItems": 1
},
"friendlyStateDescription": "Message Delivered",
"retryAllowed": false,
"retry": null,
"latestEventAt": "2018-07-24T20:59:32.156Z",
"flags": [],
"source": "textus"
}
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"
}