addMessages

The addMessages function allows you to add new messages to your account.

Overview

Currently the API does not support the structure of email message editor messages. Any messages you add with addMessages can only be opened in the platform using the HTML or WYSIWYG message editor.

Note: When you insert dynamic links in messages via the API, Bronto will only track up to 30 dynamic links for single send messages and up to 10 for bulk messages.

Syntax

writeResult = bApi.addMessages(messageObject[] messages);

Attributes

Name Type Required Description
name string Yes The name of this message
messageFolderId string No; default is the root (top-level) folder The ID of the folder containing this message
content MessageContentObject[] No Array of contents for this message
deeplink MessageContentObject[] No Part of the array, determines if a link is a deep link.

PHP Code Example

<?php
/* This script will add an HTML message with some basic HTML content. 
   @copyright Copyright (c) 2018 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 in a valid API token 
  $token = "ADD API 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)); 
 
  // Be sure to replace the example subject and content 
  $MessageContentObject = array('type' => 'html', 'subject' => 'Example Subject Line', 'content' => '<h1> Some HTML can go here</h1><p>Some more can go here.</p>' ); 
 
  // Give the message a valid name 
  $message = array('name' => 'Example Message Name', 'content' => $MessageContentObject ); 
  print "Adding the message\n"; 
  $write_result = $client>addMessages(array($message) )->return; if ($write_result->errors) { print "There was a problem adding the message:\n"; 
  print_r($write_result->results);
  } else { 
  print "The message has been created. Id: " . $write_result->results[0]->id . "\n"; 
  } 
} catch (Exception $e) { print "uncaught exception\n";
 print_r($e); 
}