CallFire has a new API!
We are proud to announce the launch of our API 2.0! Learn more about our streamlined, transactional and broadcast APIs. This version of the API documentation will remain available for reference only. There will be no new development, only bug fixes. We highly recommend upgrading to our newer and more sophisticated documentation.
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. The broadcastId can also be passed to
GetBroadcastStats
to get information about the text campaign, such as BilledAmount, Duration, State, etc...
The industry standard is for text messages to be limited to 160 characters or less. If the
message is over 160 characters then a BigMessageStrategy
should be selected in
the TextBroadcastConfig
.
Request Parameters
Parameter | Demo Value | Description | Data Type |
---|---|---|---|
SendText | Data (ToNumber and Message) needed to start a text campaign | object | |
RequestId | Unique ID, used to de-dup requests and make sure request is not processed twice | anyURI | |
Type | Type of Broadcast[VOICE, IVR, TEXT, CCC] | BroadcastType | |
BroadcastName | Title of Broadcast (default: API Send) | string | |
ToNumber | List of E.164 11 digit numbers space or comma separated | List[PhoneNumber] | |
ScrubBroadcastDuplicates | Scrub duplicates (default: false) | boolean | |
Label | Label for Broadcast | string | |
TextBroadcastConfig | Configuration needed for a Text Broadcast | object | |
id | Unique ID of BroadcastConfig | long | |
Created | DateTime Broadcast was created 'CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]' | dateTime | |
FromNumber | E.164 11 digit number or short code | PhoneNumber | |
LocalTimeZoneRestriction | Restrict the times your compaign can run | object | |
BeginTime | Earliest time a client can be contacted in the timezone associated with the number's NPA/NXX | time | |
EndTime | Latest time a client can be contacted in the timezone associated with the number's NPA/NXX | time | |
RetryConfig | Retry logic for broadcast | object | |
MaxAttempts | Max attempts to retry broadcast (default: 1) | int | |
MinutesBetweenAttempts | Minutes between broadcast attempts (default: 60) | int | |
RetryResults | Conditions to retry on[LA, AM, BUSY, DNC, XFER, NO_ANS, XFER_LEG, SENT, RECEIVED, DNT, TOO_BIG, INTERNAL_ERROR, CARRIER_ERROR, CARRIER_TEMP_ERROR, UNDIALED, SD, POSTPONED, ABANDONED, SKIPPED, INVALID_NUMBER] | List[Result] | |
RetryPhoneTypes | Phone types to call in retry[FIRST_NUMBER, HOME_PHONE, WORK_PHONE, MOBILE_PHONE] | List[RetryPhoneType] | |
Message | 160 char or less message to be sent in text broadcast. Use rented 'keyword' in message if need response | string | |
BigMessageStrategy | Set strategy if message is over 160 chars (default: SEND_MULTIPLE)[SEND_MULTIPLE, DO_NOT_SEND, TRIM, MMS, RCS] | BigMessageStrategy | |
BroadcastId | BroadcastId to send message from | long | |
UseDefaultBroadcast | If true send text through existing default broadcast (default: false) | boolean |
* indicates choice value, bolded parameters are required
Response Parameters
Parameter | Description | Data Type |
---|---|---|
CreatedId | Unique ID of resource | long |
<?php
/**
* You'll need your login/password pair when you create the SOAP client.
* Don't use the fake login/password provided here; it's just for show and
* won't work.
*/
$wsdl = "http://callfire.com/api/1.1/wsdl/callfire-service-http-soap12.wsdl";
$client = new SoapClient($wsdl, array(
'soap_version' => SOAP_1_2,
'login' => 'YourLoginId',
'password' => 'YourPassword'));
/**
* SendText. Need to include 'ToNumber' and 'TextBroadcastConfig->Message' as
* minimal amount of information needed for sending a text message .
*/
$request = new stdclass();
$request->BroadcastName = 'Test SMS Broadcast'; // string
$request->ToNumber = array('13105551212', '18185551212'); // required
$request->TextBroadcastConfig = new stdclass(); // required
$request->TextBroadcastConfig->Message = 'Hello, just testing SMS messaging'; // string required
$broadcastId = $client->SendText($request);
echo "broadcastId: $broadcastId";
// Example output: broadcastId: 11
//
// Lets add 'FromNumber' and 'LocalTimeZoneRestriction' to request.
//
$request = new stdclass();
$request->BroadcastName = 'Test SMS Broadcast'; // string
$request->ToNumber = array('13105551212', '18185551212'); // required
$request->TextBroadcastConfig = new stdclass(); // required
$request->TextBroadcastConfig->Message = 'Hello, just testing SMS messaging'; // string required
$request->TextBroadcastConfig->FromNumber = '18185551212';
$request->TextBroadcastConfig->LocalTimeZoneRestriction = new stdclass(); // object
$request->TextBroadcastConfig->LocalTimeZoneRestriction->BeginTime = '09:00:00'; // time
$request->TextBroadcastConfig->LocalTimeZoneRestriction->EndTime = '17:00:00'; // time
$broadcastId = $client->SendText($request);
echo "broadcastId: $broadcastId";
// Example output: broadcastId: 12
//
// Or send a text message with keyword that receipients should reply to.
//
$request = new stdclass();
$request->BroadcastName = 'Test SMS Broadcast with > 160 chars and TEST keyword,';
$request->ToNumber = array('13105551212', '18185551212'); // required
$request->TextBroadcastConfig = new stdclass(); // required
$request->TextBroadcastConfig->Message = 'Hello, reply with TEST is response.'
. ' This is a very long message (> 160 chars) so set BigMessageStrategy'
. ' to SEND_MULTIPLE, DO_NOT_SEND, or TRIM. Here is the part to TRIM,'
. ' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.'
. ' This piece of text should NOT show if BigMessageStrategy = TRIM'; // string required
$request->TextBroadcastConfig->FromNumber = '67076'; // string
$request->TextBroadcastConfig->BigMessageStrategy = 'TRIM'; // [SEND_MULTIPLE, DO_NOT_SEND, TRIM]
$broadcastId = $client->SendText($request);
echo "broadcastId: $broadcastId";
// Example output: broadcastId: 12
?>