Text
Texts endpoint
API path: https://www.callfire.com/api/1.1/rest/text
All api endpoints return response in XML format by default, to get response in JSON put .json at the end of API path.
Send a text
- Method: POST
- Request URI: /text
Sending a text message requires at least a toNumber and a message. SendText starts a text campaign and returns the broadcastId if campaign is successful started. This returned broadcastId can be passed to QueryTexts to get state of text messages in campaign and get list of individual textId for use in GetText calls.
Operation parameters
- Type - Type of Broadcast, must be set to TEXT
- BroadcastName - Title of Broadcast (default: API Send)
- To - List of E.164 11 digit numbers space or comma separated
- ScrubBroadcastDuplicates - Scrub duplicates (default: false)
- Label - Label for Broadcast
- From - E.164 11 digit number or short code
- LocalRestrictBegin - Earliest time a client can be contacted in the timezone associated with the number's NPA/NXX, format: HH:mm:ss
- LocalRestrictEnd - Latest time a client can be contacted in the timezone associated with the number's NPA/NXX, format: HH:mm:ss
- MaxAttempts - Max attempts to retry broadcast (default: 1)
- MinutesBetweenAttempts - Minutes between broadcast attempts (default: 60)
- RetryResults - Conditions to retry on
- RetryPhoneTypes - Phone types to call in retry
- Message - 160 char or less message to be sent in text broadcast. Use rented 'keyword' in message if need response
- BigMessageStrategy - Set strategy if message is over 160 chars (default: SEND_MULTIPLE), possible values:
- SEND_MULTIPLE - send as multiple texts
- DO_NOT_SEND - do not send in case of long text
- TRIM - trims to 160 chars
- BroadcastId - BroadcastId to send message from
- UseDefaultBroadcast - If true send text through existing default broadcast (default: false)
Example request
$ curl https://www.callfire.com/api/1.1/rest/text.json \
-X POST \
-u login:password \
-d Type=TEXT \
-d To=112132212384,14243876936 \
-d BroadcastName=Send Api \
-d From=67076 \
-d Message=Hello Callfire
Example response
response code - 201 Created
{
"ResourceReference": {
"Id":609951003,
"Location":"https://www.callfire.com/api/1.1/rest/broadcast/609951003"
}
}
Query texts
- Method: GET
- Request URI: /text
Query for text messages and filter on batchId, broadcastId, toNumber, etc. Returns a list of text messages and all associated info. See GetText to return just a single text action by id.
Operation parameters
- FirstResult - Start of next result set (default: 0)
- MaxResults - Max number of results to return limited to 1000 (default: 1000)
- BroadcastId - filter by broadcastId
- BatchId - filter by batchId
- State - filter by text internal state, available values (see detail description at call states and results):
- READY
- SELECTED
- CALLBACK
- DISABLED
- SKIPPED
- FINISHED
- DNC
- DUP
- INVALID
- TIMEOUT
- PERIOD_LIMIT
- Result - text result, possible values:
- SENT - message sent
- RECEIVED - message received
- DNT - contact is in DNT list
- TOO_BIG - message is too big
- INTERNAL_ERROR - Callfire internal error
- CARRIER_ERROR - error has occurred on upstream carrier
- Inbound - filter inbound texts
- IntervalBegin - beginning of DateTime interval to search on, format: "yyyy-MM-dd'T'HH:mm:ssXXX"
- IntervalEnd - end of DateTime interval to search on, format: "yyyy-MM-dd'T'HH:mm:ssXXX"
- FromNumber - filter by from number
- ToNumber - filter by to number
- LabelName - filter by label
Example request
$ curl https://www.callfire.com/api/1.1/rest/text.json \
-u login:password \
-X GET \
-d MaxResults=2 \
-d BroadcastId=6117655003 \
-d Result=SENT \
-d IntervalBegin=2016-02-01'T'23:00:00
Example response
response code - 200 OK
{
"ResourceList": {
"@totalResults": 2,
"Text": [
{
"@id": 896807881003,
"FromNumber": "67076",
"ToNumber": {
"value": "16505044730"
},
"State": "FINISHED",
"BroadcastId": 6117655003,
"ContactId": 685332955003,
"Inbound": false,
"Created": "2016-05-23T19:05:04Z",
"Modified": "2016-05-23T19:05:03Z",
"FinalResult": "SENT",
"Message": "Api test message",
"TextRecord": [
{
"@id": 494294178003,
"Result": "SENT",
"FinishTime": "2016-05-23T19:05:02Z",
"BilledAmount": 1.0,
"SwitchId": "watson-896807881003",
"CallerName": "watson",
"Message": "Api test message"
}
]
},
{
"@id": 896138978003,
"FromNumber": "67076",
"ToNumber": {
"value": "16505339974"
},
"State": "FINISHED",
"BroadcastId": 6117655003,
"ContactId": 684986387003,
"Inbound": false,
"Created": "2016-05-23T16:26:38Z",
"Modified": "2016-05-23T16:26:39Z",
"FinalResult": "SENT",
"Message": "Api test message",
"TextRecord": [
{
"@id": 493815417003,
"Result": "SENT",
"FinishTime": "2016-05-23T16:26:37Z",
"BilledAmount": 1.0,
"SwitchId": "watson-896138978003",
"CallerName": "watson",
"Message": "Api test message"
}
]
}
]
}
}
Get single text
- Method: GET
- Request URI: /text/{id}
Return individual text message. See QueryTexts to return a list of text messages and determine individual textIds.
Operation parameters
- Id - Unique ID of resource
Example request
$ curl https://www.callfire.com/api/1.1/rest/text/6090706003.json \
-u login:password
Example response
response code - 200 OK
{
"Resource": {
"Text": {
"@id": 960348659003,
"FromNumber": "16505044730",
"ToNumber": {
"value": "67076"
},
"State": "FINISHED",
"ContactId": 732803714003,
"Inbound": true,
"Created": "2016-06-23T13:41:04Z",
"Modified": "2016-06-23T13:41:03Z",
"FinalResult": "RECEIVED",
"Message": "KEYWORD hello Callfire!",
"TextRecord": [
{
"@id": 533298364003,
"Result": "RECEIVED",
"FinishTime": "2016-06-23T13:41:04Z",
"BilledAmount": 1.0,
"SwitchId": "b682fcbe-60cd-43f5-966a-7dcbea177453",
"Message": "KEYWORD hello Callfire!"
}
]
}
}
}