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.
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);
});
Use Cases for Webhooks with Spur
Send WhatsApp message on filling Popups on the website
2. Send messages from your custom CRM via Spur
Conclusion
With webhooks and Spur, the limits are endless. Whether it's small shipment updates or a creative marketing campaign, anything can be done!