The addSMSDeliveries function allows you to add new SMS deliveries.


writeResult = bApi.addSMSDeliveries(smsDeliveryObject[] deliveries);


Name Type Required Description
start dateTime Yes The date the SMS delivery is scheduled to be sent. You can (and should) specify a timezone offset if you do not want the system to assume you are providing a time in UTC (Universal Coordinated Time / Greenwich Mean Time). For the Eastern Time Zone on Daylight Savings Time, this would be YYYY-MM-DDTHH:MM:SS-04:00.
messageId string Yes The id of the SMS message associated with the delivery. You must reference the SMS message you want to use in the SMS delivery by ID. The messageId can be obtained in the application UI. It will appear in the bottom right corner of the screen when viewing an individual SMS message.
recipients deliveryRecipientObject[] No An array of deliveryRecipientObjects that specify the contact(s) and or keyword(s) the SMS delivery will be sent to.
Note: If you are sending to a single contact, use the SMSDeliveryContactsObject to specify the contact ID.
fields smsMessageFieldObject[] Yes If you are using API message tags in your SMS message, you can use the smsMessageFieldObject to specify which content to pass in.

PHP Code Example

/* This example will create an SMS delivery and send it to an entire keyword. 
* This example * also demonstrates how to use the fields attribute to pass in data that 
* will replace * API message tags contained in the body of the SMS message. 
* Be sure to replace the placeholder text below with real values. */ 
$client = new SoapClient('', array('trace' => 1, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS)); setlocale(LC_ALL, 'en_US'); 
try { 
  $token = "YOUR_TOKEN_HERE";
  print "logging in\n";
  $sessionId = $client->login(array('apiToken' => $token))->return;
  $session_header = new SoapHeader("",
                   array('sessionId' => $sessionId));

   $client->setSoapHeaders(array($session_header)); // Make delivery start timestamp 
   $now = date('c'); // Used to replace API message tags in your SMS message with the // value you pass in for 'content'.
   $smsMessageFieldObject = array('name' => 'SOME API MESSAGE TAG NAME', 'content' => 'SOME EXAMPLE CONTENT'); 
   $delivery = array('start' => $now, 'messageId' => 'ADD SMS MESSAGE ID HERE', 'keywords' => 'ADD KEYWORD ID HERE', 'fields' => $smsMessageFieldObject ); 

   $write_result = $client->addSMSDeliveries(array($delivery)

   if ($write_result->$errors) {
     print "There was a problem adding the SMS delivery:\n"; 
   else { 
     print "The SMS delivery has been successfully created.\n"; } 
     catch (Exception $e) { 
       print "uncaught exception\n";

Python Code Example

import sys
import logging
from suds.client import Client
from suds import WebFault
from datetime import datetime
# This example script will login to the API, and schedule an 
# SMS delivery. This example demonstrates how to send to a specific 
# contact. It also demonstrates how to 
# pass in content to replace API message tags contained in the SMS message.
# Tested with Python 2.6.1 and suds soap library version 0.4
# See suds home page:
# Bronto API WSDL
# Start up basic logging
# Replace the placeholder text with a valid
# API token
# Login using the token to obtain a session ID
bApi = Client( BRONTO_WSDL )
    session_id = bApi.service.login(TOKEN)
# Just exit if something goes wrong
except WebFault, e:
   print '\nERROR MESSAGE:'
   print e
# Set up the soap headers using the
# session_id obtained from login()
session_header = bApi.factory.create("sessionHeader")
session_header.sessionId = session_id
# Get the current date and time so we can send the
# SMS message now
sendtime =
# Set up the smsdeliveryObject
# Be sure to replace the placeholder text below
add_sms_delivery = bApi.factory.create('smsdeliveryObject')
add_sms_delivery.start = sendtime
add_sms_delivery.messageId = 'SMS MESSAGE ID'
# Set up the deliveryRecipientObject object. This allows you
# to send to specific contacts and or keywords. Multiple
# contacts can be sent to by passing in an array of contactIds.
deliveryRecipientObject = bApi.factory.create('deliveryRecipientObject')
deliveryRecipientObject.type = 'contact' = 'CONTACT ID'
add_sms_delivery.recipients = deliveryRecipientObject
# set up the smsMessageFieldObject. This allows you to pass
# in content that will replace API message tags in the SMS
# message.
smsMessageFieldObject = bApi.factory.create('smsMessageFieldObject') = 'API MESSAGE TAG NAME'
smsMessageFieldObject.content = 'SOME CONTENT TO PASS IN'
add_sms_delivery.fields = smsMessageFieldObject
    delivery = bApi.service.addSMSDeliveries(add_sms_delivery)
    if delivery.results[0].isError == True:
        print 'There was an error with your request:'
        print delivery.results[0]
        print 'The SMS delivery has been sent.'
except WebFault, e:
    print '\nERROR MESSAGE:'
    print e