Send Email (PHP)

This tutorial is intended for view on larger devices.

Email Yourself a link for later

Send Email

You can use the API to schedule message delivieries. This example will create a delivery to send a message to a single contact. It assumes you have already created a message containing the following API messages tags: %%#purchasetable%% and %%#cardlast4%%.

Start Tutorial

Authenticate With Bronto

Before you can login using the API, you need to log into Bronto and set up your authentication and API access tokens. To do this:

  1. Go to Home->Data Exchange.
  2. Click Add Access Token.
  3. Make sure the token has Read, Write and Send permissions.
  4. Create API Session

    Use the access token you created to log in. The session ID created when you log into the API will expire if there is no transaction for a 20 minute period.

    Get the Message ID

    Get the ID for the message you want to send. You will need to use this ID in a later step.

    Get the Contact ID

    Get the ID for the contact you want to send to. You will need to use this ID in a later step.

    Make the Delivery Timestamp

    Indicate the start time for the message delivery.

    Provide Delivery Parameters

    Create an array that contains all of the delivery parameters. This should include:

    • the start time
    • the message ID
    • your sender information (from name, from email address)
    • the contact ID
    • Any data that tags or loops in the message need in order to display properly. For example, if the message has a cart loop you need to provide the relevant cart mapping data.
    • Results

      After you send the message you will receive a confirmation or error message. In the event of an error, we suggest you retry connecting to the API a few times before exiting your script, and saving in an error log when the failure happened.

      In order to retrieve all objects in a result set, you must iterate over all the available pages. This is done by incrementing the pageNumber parameter on subsequent read calls. When the API returns an empty result set, you know that you have retrieved all objects available. The initial page number is 1. The behavior of making multiple read calls to the same page is not defined and should not be relied upon to perform successfully.