Need to improve your marketing automation workflows? You can trigger 3rd party applications as an effect for any of your promotions by creating a webhook with Talon.One.
In the Talon.One Developer Tools, developers can create webhooks to other web applications and test the implementation within your account. A webhook is an HTTP callback which is triggered by an event; for instance, sending an SMS message when a new customer registers.
This article will show you how to use the webhook feature by implementing Twilio, a communications platform for building SMS, voice and messaging applications, into a Talon.One ruleset.
First, you'll need some information from your Twilio account before you implement the webhook in Talon.One.
You will need the following:
The Twilio documentation gives a sample API command to send an SMS. This will tell us the information needed to create the Twilio webhook in Talon.One.
curl -X POST 'https://api.twilio.com/Accounts/account_SID/Messages.json' \
--data-urlencode 'To=recipient#' \
--data-urlencode 'From=twilio#' \
--data-urlencode 'Body=Message Text' \
You can execute this command to test that all your Twilio information is set up correctly.
In the Talon.One Developer Tools, there is a setting to manage your webhooks. Here you can create your Twilio webhook.
You will need to add a few key things for this webhook.
First, you need to add the parameters which are the recipient's phone number, the sender's phone number, and the text of the message. From the Twilio command, you can see that these three parameters are string types.
You can also see the parameters' Content-Type is data-urlencode so this information should be added as a Header like so: Content-Type: application/x-www-form-urlencoded
The request for this webhook will be the exact same as the Twilio request, a POST to the Twilio messaging in your account.
You will also need to add an HTTP authentication header, but first you need to encode your Twilio Authorization Token.
You should encode api:$your_authorization_token as base64 and add a Header like: Authorization: Basic your_encoded_auth_token.
The last thing to add is the payload. A payload consists of the input parameters that the request contains and looks like this:
Now that the Twilio Webhook is created, you want to implement it into a Campaign and test the functionality. You can head to the Campaign where you'd like to use it and go to the Rule Builder. Here you can create your rule, for instance when a new customer registers then send an SMS message saying "Welcome new customer!"
Once you have enabled the Campaign, you can head to the API Tester in the Developer Tools to create a command to test your new rule. For our example rule, you can create a new customer profile to test it. In the webhook logs, you will see the response to the request. If an error occurred you can see the response for debugging.
If your test succeeded, congrats! Now you can use this methodology to create other webhooks in Talon.One.