Webhooks
A webhook allows a Talon.One Application to send information in real-time to third-party software. A webhook is configured to be triggered by a specific event and sends an HTTP request (POST, PUT, GET, DELETE, PATCH).
In the case of Talon.One, you can create webhooks to communicate information from the Talon.One Rule Engine to an external system. A webhook is always triggered as an effect inside a rule.
This a generic topic about webhooks, to see a concrete example, see the webhook tutorial.
note
If you prefer returning the information you need as an effect, create a custom effect instead.
Creating a webhook
To create a webhook:
In the bottom-left corner of the Campaign Manager, click Account > Dev Tools > Webhooks > Create webhook.
Edit the fields as needed:
Use the Parameters section to define parameters in your webhook than can be populated when a rule gets executed.
This allows you to share data from the Rule Engine with the recipient of the webhook.
Use the Request section to set the URL of the receiving service, for example, one of your webapp's endpoints.
Use the Payload section to represent the data of your webhook.
Use the webhook inside a rule as an effect. For more information, see the product docs.
For a concrete example, see the webhook tutorial.
Defining a webhook's payload
When you define the payload of your webhook you can use parameters and attributes:
- A parameter is a value you set in a rule and that gets inserted in your payload when the rule is executed.
- An attribute is a value that is stored inside Talon.One. It can come from the integration layer via the Update customer profile or Update customer session endpoints such as the customer's location or the session's value.
Using parameters in a webhook
A parameter allows you to set its value from a rule.
For example, if we want to send an email via a webhook, we can set the body of the email from a rule:
- Create a parameter named
bodyText
: - Add a
body
property in our JSON payload to hold the parameter value: - Create a rule that uses this webhook as an effect and we set the
bodyText
parameter value:
Alternatively, we can share data from Talon.One without relying on data set in a rule thanks to attributes.
Using attributes in a webhook
You can send any attribute in your payload. If you do not know what attributes are, see attributes.
To list available attributes, use the Attribute Library. To open the library, in the lower-left corner, click Account > Dev tools > Attributes > Attribute Library.
There are 2 categories of attributes: custom and built-in.
The way you reference them in your payload depends on their category.
Using a custom attribute
To use a custom attribute, use the <entity>.Attributes.<attributeName>
pattern.
Example: Coupon.myAttribute
becomes "my_prop": "${$Coupon.Attributes.myAttribute}"
.
Using a built-in attribute
To use a built-in/predefined attribute, use the <entity>.<attributeName>
pattern.
Example: To use a customer profile's integration id, use Profile.IntegrationId
.
note
If you are using the attribute library to find entity names, rename the following entities as follows:
CustomerProfile
toProfile
CustomerSession
toSession
Examples:
CustomerProfile.name
becomes"my_prop": "${$Profile.name}"
.CustomerSession.CurrentLocation
becomes"my_prop": "${$Session.CurrentLocation}"
.
To see a list of built-in attributes, see Attributes.
For a webhook example, see the webhook tutorial.
Webhook retry policy
If a webhook fails or receives an error, it is triggered 10 times with an increasing amount of time between each attempt.