Skip to main content

Creating a webhook to Iterable

You can use a webhook as an effect in Talon.One to trigger an email campaign in Iterable.

example

Based on the conditions of your Talon.One campaign, you can generate a coupon code for a user and pass it to Iterable in a webhook effect. The Iterable campaign you set up can then email the coupon code to the target user.

In this basic tutorial, we will use the following:

  • In Iterable: The template feature.
  • In Talon.One:
    • The webhook feature.
    • An Iterable email as an effect.

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 fields. When the campaign is triggered and the email template is sent, the placeholders are populated with values from Talon.One.

tip

To learn about using the dynamic content builder, see the Iterable documentation.

You can use the following example to create your email template:

Hi {{firstName}},

Thank you for your recent purchase.

Use {{couponCode}} to get 10% off your next purchase over $20. The code is valid only for the next 7 days.

To unsubscribe from these emails, click {{unsubscribeUrl}}.

Creating a triggered campaign in Iterable

To create a campaign in Iterable, follow the instructions provided in the Iterable documentation.

Make a note of the 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, retain the other default values, 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. In the Campaign Manager, click Account > Tools > Webhooks, and click Create Webhook.
  2. Name the webhook, 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, the URL is: https://api.iterable.com/api/email/target.
  3. In Headers, click Add to define the following HTTP headers:
    • Api-Key: <The API key created in Iterable>
    • Content-Type: application/json

Creating the payload

Let's populate the payload of the request. The body should contain the email addressee details and information about populating all of the placeholders in the email template.

To create the payload:

  1. Use the campaignId field to store the campaign ID found in the first step.

  2. Retrieve the email address and name of the addressee from the Talon.One customer profile.

    note

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

  3. Ensure that the coupon code can be dynamically generated by Talon.One.

    note

    Your setup may vary depending on the data you wish to dynamically populate in the email, but the same principles apply.

    Define the following payload:

    curl -v -X POST \
    -H 'Content-Type: application/json' \
    -H 'Api-Key: 623b423a088f4e97ab2036cbf8073870' \
    -d '{
    "campaignId": ${$CampaignID},
    "recipientUserId": "${$CustomerProfileID}",
    "dataFields": {
    "couponCode": "${$CouponCode}"
    }
    }' \
    'https://api.iterable.com/api/email/target'
  4. Click Create.

To learn more about accessing Talon.One attributes and including them in the webhook, see Using parameters in a webhook.

Triggering Iterable emails as an effect

We can now trigger an Iterable email via the Rule Builder.

To trigger Iterable emails as an effect:

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

Here we can create a coupon code for the customer and trigger a personalized Iterable email that includes that code.

Every time the rule is valid, the effect triggers Iterable to send an email to the current customer.