This documentation will cover how to setup a Zapier webhook to catch incoming data from other CRM, Dispatch software.
Setup the Trigger
Choose app & event:
- Zap Type: Webhooks by Zapier
- Trigger Event: Catch Hook
- Click Continue
Set up trigger
- Copy Customer Webhook URL
Test trigger
- Select the request when the payload has been sent
Parse JSON
Sometimes we get data from a previous Step that contains multiple fields as as an array/line-item of names and values instead of individual values with their own unique names that we can map into later Steps. The source of the data could be any app, but more commonly it would be from an advanced action such as a Webhook Step. We can solve this problem by using 2 Steps: A Formatter by Zapier Step followed by a short bit of Code in a Code by Zapier Step.
The Formatter Step will be the Utilities
Action and the Line-item to Text
transform. The reason that we want to start with this is to make sure that if there are any commas or empty elements in our line items that they don’t get split up incorrectly or dropped, respectively. Inputting line items directly into a Code Step can have that effect in some situations.
In the Formatter Step, we can map both the “name” array and the “value” array separated by some text that is unlikely to exist in our values. In this case, I used ***
. We also want to put a custom separator between each name and value pair. I’ve used |||
in this case as it is different from *** and is also unlikely to appear in our values:
When we test the Formatter Step, we can see that we get a text
value output that contains all the value names and values with the separators in-between:
Next, we want to add a Code by Zapier Run Javascript
Action. Don’t worry if you don’t understand the code below. You can paste the Code into the Code field as is without making any changes. Be sure to set an Input Data field as text
and map in the text value from the Formatter as shown in green here:
Here is the code for you to copy into your Code Step:
const text = inputData.text.split('|||'); let obj = {}; text.forEach((element) => { const [name, value] = element.split('***'); obj[name] = value; }); output = [obj];
When we test the Code Step, we can see that it has processed our text from the Formatter into a series of single values that we can now map into later Steps (highlighted in red). For example, if we wanted to map the email field (highlighted in green), we now have that as an individual value:
Setup the LaunchSMS Outgoing Message Action
- Zap Type: LaunchSMS Outgoing Message Zap
- Action Event: Send LaunchSMS Outgoing Message
Choose account
Select or log into your LaunchSMS Account
If you have already authorized your LaunchSMS account in Zapier then select your connected account.
If you haven’t authorized your LaunchSMS account in Zapier then click “Connect a new account” and enter your LaunchSMS Email address and password.
Set up action
- Select the customer’s mobile number from your Javascript Action
- Enter the message you would like your customer’s to receive when the CRM/Dispatch software send their payload to your Zapier Webhook.
Test action
Test the action and when it is successful, Zapier will send you a successful message.