Sending a text message
To send a text message you would use the send_text_message action. When you send a text message you need to send it to one or more members or one or more tags. These are specified in the body of the action.
Send Text Message Example
{
"action":"send_text_message",
"type":"sms",
"text":"hello world",
"scheduleDelivery":"false",
"deliveryDate":"123456000",
"mediaUrl":"http://www.server.com/media.png",
"contentType":"image/png"
"tags":[],
"members":[],
"phone":"6125550123",
"all":"false"
}
Field |
Required |
Description |
|
type |
No |
The type of message to send “sms” or “mms”. Default is “sms” |
|
text |
Yes |
The text of the message |
|
scheduleDelivery |
No |
If the message should be scheduled for delivery at a later time. Boolean - default is false |
|
deliveryDate |
No |
The UTC time the message should be delivered. Required if scheduleDelivery is true. Long |
|
mediaUrl |
No |
The url for the media for an mms. Required if type=”mms”. |
|
contentType |
No |
The mime type of media for the mediaUrl. Required if type=”mms”. |
|
tags |
No* |
An array of the tags that of members who this message should be sent to. |
|
members |
No* |
An array of the member ids that this message should be sent to. |
|
phone |
No* |
A single phone number (10 digit). |
|
all |
No* |
|
*One of tags/members/phone/all is required.
The response will indicate the number of messages successfully sent.
Getting messages
Use the get_messages action to get an array of all the messages that have been exchanged with an individual member.
Get Messages Example
{
"action":"get_messages",
"limit":"10",
"offset":"0",
"contact":"103",
"member":"103",
"from":"123456000",
"to":"123457000"
}
Field |
Required |
Description |
limit |
No |
The number of messages to return (pagination control) |
offset |
No |
The starting message for the results (pagination control) |
contact |
No |
The phone number (E64 format required) of the contact to get messages for. (supersedes member and from/to) |
member |
No |
The id of the member to get messages for. (supersedes from/to) |
from |
No |
The beginning date in a date range to get messages for. Long (UTC) |
to |
No |
Required if from is present. The end date in a date range to get messages for. Long (UTC) |
The response will contain an object with the passed in limit and offset, and an array of communications objects (see below).
Communication response Example
{
date:1487204190247,
direction:"outbound",
from_city:"",
from_country:"",
from_number:"+16124251858",
from_state:"",
from_zip:"",
id:1,
messages:[],
mms:[],
recordings:[],
to_city:"",
to_country:"",
to_number:"+16123630902",
to_state:"",
to_zip:"",
transcripts:[],
type:"sms",
userId:14,
}
Field |
Description |
direction |
Message direction. “inbound” or “outbound” |
id |
Communication id |
messages |
Array of sms messages associated with this communication |
mms |
Array of mms messages associated with this communication |
recordings |
Future Feature |
transcripts |
Future Feature |
type |
The type of communication. “sms” or “mms” |
userId |
The id of the user the communication is associated with |
Communication response Esample: messages
{
comm:1,
date:"2017-02-15 18:16:30.251571",
id:1,
sms:"Test Message"
}
Field |
Description |
comm |
The comm id this message is for |
date |
The date the message was sent/received |
id |
The id of the message |
sms |
The text of the message |
Communication response: mms
{
comm:109,
contentType:"text/vcard",
date:"2017-08-24 09:41:30.254955",
id:13,
mms_url:"https://s3.amazonaws.com/dart-tenant38/vcard.vcf",
}
Field |
Description |
comm |
The comm id this message is for |
date |
The date the message was sent/received |
id |
The id of the mms |
contentType |
The mime type for the mms |
mms_url |
The url to for the mms content |
Comments
0 comments
Please sign in to leave a comment.