12th Apr 2021

Creating a webhook

In this tutorial, let's create a webhook in the Campaign Manager to send some data from Talon.One.

We want to send 2 attributes, the customer's email and name, and one webhook-defined property, some body text. The recipient of this webhook is RequestBin. RequestBin allows us to inspect the content of our webhook.

For general information about Webhooks, see Webhooks.

Creating the webhook

Let's create our webhook:

  1. Open RequestBin and click Create a RequestBin and keep the page open. We'll need the Bin URL later.
  2. In Talon.One, click Account > Dev Tools > Webhooks > Create webhook.
  3. Enter the title of the webhook, for example My webhook test and the application which will use it.
  4. Tick Display in Rule Builder.
  5. Add a string parameter name bodyText to the request.
  6. Fill in the request verb and URL as follows and click Add:
    • Verb: POST
    • URL: your Bin URL
  7. Add the following header:

    Content-Type: application/json
  8. Add the following payload:

    {
        "name": "${$Profile.Attributes.name}",
        "email": "${$Profile.Attributes.email}",
        "body": "${$bodyText}"
    }

    This name and email properties hold predefined attribute values. The body property represents the bodyText property defined in the webhook.

  9. Click Create.

The webhook is created, let's use it in a rule to use it.

Creating the rule that uses the webhook

  1. Open the Rule Editor and create a new rule.
  2. Choose a condition that you can easily trigger. In our case, we use Session total > 500.
  3. Click Add effect and select Webhook: My webhook test. Our webhook has a required bodyText parameter. Enter a value, for example Thank you for shopping with us!
  4. Save the rule and activate the campaign.

Now, every time a customer has a session total of more than $500, our RequestBin receives a request containing the following body:

   {
       "name": "<name of the customer>",
       "email": "<email address of the customer>",
       "body": "Thank you for shopping with us!"
   }

Note: Refresh the RequestBin page to see the requests.

Still need help? Get in touch!
Last updated on 12th Apr 2021

Was this article helpful?

Thank you! You have already voted

If you’d like a member of our support team to respond to you, please send a note to support@talon.one