Webhooks are powerful ways to trigger an action programmatically in other applications. A Webhook is nothing but an API call made by a system to some other system. Most of the modern SMS service providers supports an API which can be called to trigger an SMS using their services. Blueshift’s webhook capabilities for SMS allows you to connect such SMS service provider and trigger SMS messages from Blueshift’s campaign journey.
Our integration allows you to send personalized, promotional, as well as transactional SMS to your customer.
Supported message types
Blueshift's webhook capalbilties support both SMS and MMS messages.
Important
For MMS messages, you must check with your third party messaging provider to confirm which media types are supported and understand the file size limitations.
Tracked events
Note: You must first set up a webhook so that Blueshift can receive messaging events for analytics and tracking.
Prerequisites
Before you can set up integration with Blueshift, you must have your provider's webhook URL handy.
Note
It is important that all your customer phone numbers are saved in the E.164 standard.
Set up integration
To use the SMS service provider of your choice to send messages, simply add your provider's webhook URL to the adapter you create in Blueshift.
To set up integration, complete the following steps:
- Sign in to the Blueshift app, and click App Hub in the left navigation menu.
- Go to All Apps, search for, and select SMS via Webhook.
- You can also go to SMS Apps and select SMS via Webhook.
- Click Configure to view all the configured adapters.
- Click +ADAPTER to add an adapter.
- Add a Name for the adapter. If you have multiple adapters, the adapter name helps you to identify the integration.
- Provide the following details for integration:
Field Description Webhook URL Specify the webhook URL for the provider. Auth Header Specify the authentication header for the provider. Auth Token Specify the authentication token for the provider. -
Click Save to add the adapter.
Example
Here is an example of the message sent to the webhook when you use this adapter in a campaign SMS trigger.
Note: The message might also contain the txnid field if the campaign is an Event Triggered or a Segment Triggered campaign.
{
"phone_number": "+919860504788",
"message": "This is a webhook test",
"channel": "sms",
"message_uuid": "3a9e6646-4fbd-4eb9-9b03-03cc026003c4",
"user_uuid": "42bccc0a-d3c7-458c-9fec-eba0c4ef2930",
"experiment_uuid": "8a3268bb-57e5-a9c8-9a40-6c8f3ec0d7e6",
"bsft_tracking": {
"mid": "3a9e6646-4fbd-4eb9-9b03-03cc026003c4",
"uid": "42bccc0a-d3c7-458c-9fec-eba0c4ef2930",
"bsft_ek": "2022-09-29T08:50:28Z",
"eid": "8a3268bb-57e5-a9c8-9a40-6c8f3ec0d7e6"
},
"campaign_name": "Test-SMS-Webhook-1",
"campaign_uuid": "9cc61bff-f83e-470e-b5c9-e059f5e32e34",
"trigger_uuid": "39799c77-88f4-585a-ee67-4ebf39e64ebe"
}
Next steps
- Create an SMS template for your messages.
- In your campaign journey, add an SMS trigger. On the SMS tab of the trigger, go to Send Settings and specify SMS via Webhook as the App and select the adapter that you just created.
- To use the SMS via webhook app to archive a copy of the message that you send to the user, add the SMS trigger immediately after the messaging trigger (i.e. as a daisy chain) without adding any delay or filter criteria.
- Send events data to Blueshift for analytics and tracking.
Send event data to Blueshift
If you are using a webhook to send campaign messages to your SMS provider, you can send event data back to Blueshift by using the following URLs.
- If you are in the EU region, use the hostname api.eu.getblueshift.com instead of api.getblueshift.com.
- Ensure that you use the correct field names when you send event data to Blueshift.
- The event field can have the following values: delivered and bounce.
- If the campaign message contains the field txnid, you must include the field journey_uuid in the event data that you send to Blueshift.
Short field name | Long field name |
uid, user_uuid | user_uuid |
mid, message_uuid | message_uuid |
eid, experiment_uuid | experiment_uuid |
bsft_ek | execution_key |
txnid | journey_uuid |
Send campaign delivery events
POST campaign delivery events data to the following URL:
https://api.getblueshift.com/api/v1/messaging_events/501a2456-f7c6-4f26-a335-c3f2e20fc194
For example:
{
"messaging_event": {
"event": "delivered",
"integration_app_name": "Webhook",
"phone_number":"+919860504788",
"adapter_uuid": "087d81ce-149b-4db7-90a4-a24fd9975cd6",
"message_uuid": "3a9e6646-4fbd-4eb9-9b03-03cc026003c4",
"user_uuid": "42bccc0a-d3c7-458c-9fec-eba0c4ef2930",
"experiment_uuid": "8a3268bb-57e5-a9c8-9a40-6c8f3ec0d7e6",
"execution_key": "2022-09-29T08:50:28Z"
}
}
Send subscribe/unsubscribe events
POST subscribe or unsubscribe events to the following URL:
https://api.getblueshift.com/api/v1/messaging_events/501a2456-f7c6-4f26-a335-c3f2e20fc194
For more information, see Unsubscribes for SMS.
For example:
{
"messaging_event": {
"event": "unsubscribe",
"integration_app_name": "Webhook",
"phone_number":"+919860504788",
"adapter_uuid": "087d81ce-149b-4db7-90a4-a24fd9975cd6",
"user_uuid": "42bccc0a-d3c7-458c-9fec-eba0c4ef2930"
}
}
Comments
0 comments