Skip to main content

Creating a webhook to Iterable

In this tutorial, let's trigger an Iterable email as an effect in Talon.One.

For example, you can generate a coupon code for a user when certain conditions trigger and automatically email them the code via Iterable.

We will rely on the template feature in Iterable, and the webhook feature of Talon.One.

Creating a template in Iterable

To trigger an email, let's create a template used to send information to the user. Use the {{placeholder}} syntax to create placeholder field. It will be populated from Talon.One.

Example Email Template:

{{firstName}}, thank you for your recent purchase.

Use {{couponCode}} to get 10% off your next purchase over $20.

But hurry, the code is only active for the next 7 days.

Creating a triggered campaign in Iterable

Follow the instructions provided in the Iterable documentation.

Make note of the Campaign ID of your campaign. The Campaign ID in this example is 1960495.

Campaign ID location

Creating an API Key in Iterable

  1. Click Integrations > API Keys > NEW API KEY.
  2. Name the API key and leave all of the defaults as-is and click Create. Save the key value for later use.

Creating a webhook in Talon.One

Let's create the Talon.One webhook that triggers the Iterable email:

  1. Open the Campaign Manager, and in the bottom-left corner, click Account > Tools > Webhooks, and click Create Webhook.
  2. Give the webhook a memorable name like Send Iterable Email, and select the Application(s) in which it should be available.

Adding parameters

Add parameters for any webhook-specific data to pass to Iterable. In our case, let's imagine we want to pass a coupon code so we create the following parameter:

Param typeParam name
stringcouponcode

Creating the request

  1. In the Request section, set Verb to POST.
  2. In URL, target the relevant URL based on the transmission medium. In this case it will be: https://api.iterable.com/api/email/target?apiKey=myapikey, where you can replace myapikey with the value you generated earlier.
  3. In Headers, click Add to define the HTTP header using the format: Api-Key: <API key created in Iterable>.

Creating the payload

Let's populate the payload of the request. The body should contain the email addressee and how to populate all of the placeholders in the email template.

  1. Let's use the campaignId field to store the campaignId found in the first step.

  2. The email address and name of the addressee are retrieved from the Talon.One customer profile.

    note

    We assume emails and names are synced with Talon.One.

  3. The coupon code is dynamically generated by Talon.One.

    note

    Your setup might vary depending on what data you want to dynamically populate in the email, but the same principles apply.

    We define the following payload:

    {
    "campaignId": 1960495,
    "recipientEmail": "${$Profile.Attributes.Email}",
    "dataFields": {
    "firstName": "${$Profile.Attributes.Name}",
    "couponCode": "${$couponCode}"
    }
    }
  4. Click Create.

To learn more about how to access Talon.One attributes and include them in the webhook, see Using parameters in a webhook.

Triggering Iterable emails as an effect

Now that everything is set up, we can trigger an Iterable email via the Rule Builder.

  1. In the Campaign Manager, open your campaign and the Rule Builder.
  2. Add a new effect. In the Webhooks section, select the webhook you created earlier.

For example, here we create a coupon code for the customer and trigger a personalized Iterable email including that code.

Triggering an Iterable email as an effect in the Rule Builder.

Every time the rule is valid, it will trigger Iterable to send an email to the current customer.