removeFromSMSKeyword

The removeFromSMSKeyword function allows you to remove contacts from an SMS keyword. If you want to add contacts to an SMS keyword, use addToSMSKeyword.

Syntax

writeResult = bApi.removeFromSMSKeyword(smsKeywordObject[] keyword, contactObject[] contacts);

SMS Keyword Object Attributes

Name Type Required Description
id string Yes The unique id for an SMS keyword.

Contact Object Attributes

Name Type Required Description
id string Yes The unique id for a contact.

PHP Code Example

    <?php
      /**
      * This script will remove a contact from a SMS keyword. The contact will only
      * be dropped from the specified keyword. You can remove multiple contacts at a
      * time.
      * @copyright Copyright (c) 2018 Oracle + Bronto Software (http://www.bronto.com)
      */
 
    $client = new SoapClient('https://api.bronto.com/v4?wsdl', array('trace' => 1,
                                     'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
    try {
      // Add your API token
        $token = "ADD YOUR API TOKEN";
 
        print "Logging in\n";
        $sessionId = $client->login(array('apiToken' => $token))->return;
 
        $session_header = new SoapHeader(
            "http://api.bronto.com/v4",
            'sessionHeader',
            array('sessionId' => $sessionId)
        );
        $client->__setSoapHeaders(array($session_header));
 
    /** $smsKeywordObject is an array containing SMS keyword information
         * including the id of the keyword and the subscriber count.
         * You can find the SMS keyword API id for a keyword by looking at the footer
         * when viewing the overview page for a keyword in the application.
        */
 
      // Example with both id and name included.
        $smsKeywordObject = array("id" => "SMS KEYWORD ID");
 
 
    /** $contactObject is an array containing the contact information.
      * The contact API id is a unique identifier assigned to a contact.
      * You can find the contact API id for a contact by looking at the footer when
      * viewing the overview page for an individual contact in the application.
      * The contact email address can also be used as an id when adding contact(s).
      */
 
      // Example using both id and email.
        $contactObject = array("id" => "CONTACT ID");
 
     // Example with multiple contacts.
     //$contact1 = array("id" => "FIRST CONTACT ID");
     //$contact2 = array("id" => "SECOND CONTACT ID");
     //$contactObject = array($contact1, $contact2);
 
        $write_result = $client->removeFromSMSKeyword(array('keyword' => $smsKeywordObject, 'contacts' => $contactObject))->return;
 
        if ($write_result->results[0]->isError) {
            print "There was a problem removing the contact from the keyword:\n";
            print_r($write_result->results);
        } else {
            print "The contact has been removed from the keyword.  Id: " . $write_result->results[0]->id . "\n";
        }
    } catch (Exception $e) {
        print "uncaught exception\n";
        print_r($e);
    }