Skip to main content
How to set up Webhooks with Spur

Spur supports adding webhook triggers, now any app/tool from the world can trigger messages to Spur!

Updated over a month ago

We often get requests on XYZ app becoming able to send data to Spur and then sending messages based on it. This is quite a common functionality many workflow tools need and is now possible with Spur too.

What are webhooks?

Webhooks are a potent tool for enhancing and automating digital workflows, particularly essential in today's dynamic online ecosystems. They act as a bridge between different web applications, allowing them to communicate with each other by sending real-time data as soon as it's generated. This seamless transmission of information facilitates instant updates, thereby optimizing operational efficiencies. In the realm of eCommerce, for instance, webhooks can be instrumental in syncing inventory levels, processing orders, and triggering notifications instantly between systems. By setting up webhooks, businesses can create a tightly integrated, automated digital environment, where data flows smoothly across various platforms. This not only accelerates processes but also minimizes the room for error, ensuring a robust, responsive, and efficient operational framework.


How to use webhooks with Spur?

1. Create a new workflow

Go to Automation -> New Flow

2. Choose WhatsApp

Only WhatsApp messages can be sent via Webhooks, since you can't initiate a business conversation from Instagram or Facebook channels.

3. Select triggers & choose webhook

4. Use the unique URL and paste it onto the application/code you want to trigger webhooks from

As soon you create the trigger, a URL is generated. You can either add this url to the app /tool of you choice. Or just send a POST request to this URL and mention the phone and name of the contact. So that we know which number to send the message to.

This is the URL you will copy from Spur and paste in the other app.


Example of other App:
- Past URL in the URL box.
- Sending Phone Number & Name is required for the flow to Trigger.
- This is how you will send phone number, name and any other info in the Body of the Post request through the other app.
- Sometimes you need to select an event before you're able to add the body.

Here is an example post request:

curl --location 'https://api.spurnow.com/profiles/2/workflows/60/webhooks' --header 'Content-Type: application/json' --data '{
"phone": "919871739359",
"name": "Raju Mohan"
}'


For a framework like axios, it should be like:

const axios = require('axios');
let data = JSON.stringify({
"phone": "919871739359",
"name": "Raju Mohan"
});

let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.spurnow.com/profiles/2/workflows/60/webhooks',
headers: {
'Content-Type': 'application/json'
},
data : data
};

axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});

5. Select other info through Webhook to Spur

You can also send any other data available on the other app in the body of the Post Request like this -


This is how you can use it in Spur in a condition block - just enter {{trigger.key}} key here is whatever value you're sending from the other app. In this case the key is choice -


This is how you can use it in Spur in a Message template - again {{trigger.key}} and it will replace the variable of the Message template with the value to the key you've sent to the Webhook -

6. Test

Always test the connection before making it live for everyone. Make sure it is working as expected.


View all the values sent to the Webhook

Go to Spur Tables or the database of the Flow and click on View Trigger - it will show you all the values you're sending to the webhook of this flow, that you can use in a condition block or message template or anything else.


Use Cases for Webhooks with Spur

1. Send WhatsApp message on filling Popups on the website

2. Send messages from your custom CRM via Spur

& many more!


Conclusion

With webhooks and Spur, the limits are endless. Whether it's small shipment updates or a creative marketing campaign, anything can be done!

Did this answer your question?