addToDeliveryGroup

The addToDeliveryGroup function allows you to add messages, automated message rules, or deliveries to an existing delivery group.

Syntax

writeResult = bApi.addToDeliveryGroup(deliveryGroupObject[] deliveryGroup);

Attributes

Name Type Required Description
deliveryGroup string Yes The id associated with the delivery group you want to add items to.
deliveryIds[] string No An array of the delivery ids you want to add to the delivery group.
messageRuleIds[] string No An array of the automated message rule ids you want to add to the delivery group.
messageIds[] string No An array of the message ids you want to add to the delivery group.

PHP Code Example

<?php
/**
 * This script will add a delivery, message, and automated message rule
 * to a delivery group.
 *
 * @copyright  Copyright (c) 2011 Bronto Software (http://www.bronto.com)
 */
 
$client = new SoapClient('https://api.bronto.com/v4?wsdl', array('trace' => 1, 
                                 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
setlocale(LC_ALL, 'en_US');
 
try {
 
  // Replace with a real token!
  $token = "EXAMPLE TOKEN HERE";
 
  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));
 
  // Replace with a real deliveryId
  $deliveryIds = array('EXAMPLE DELIVERYID');
 
  // Replace with a real messageId
  $messageIds = array('EXAMPLE MESSAGEID');
 
  // Replace with a real messageRuleId
  $messageRuleIds = array('EXAMPLE MESSAGERULEID'); 
 
  // Replace with a real deliveryGroupId
  // This will be the delivery group the delivery, message, and
  // automated message rules specified above are added to
  $deliveryGroup = array('id' => 'EXAMPLE DELIVERYGROUPID');
 
  $write_result = $client->addToDeliveryGroup(array('deliveryGroup' => $deliveryGroup,
                            'deliveryIds' => $deliveryIds,
                            'messageIds' => $messageIds,
                            'messageRuleIds' => $messageRuleIds
                            ))->return;
 
    if ($write_result->errors) {
        print "There was a problem adding item to the delivery group:\n";
        print_r($write_result->results);
      } else {
        print "The items were successfully added to the delivery group. Id: " . $write_result->results[0]->id . "\n";
      }
 
  } catch (Exception $e) {
    print "uncaught exception\n";
    print_r($e);
  }
 
?>