Default Webhook Provider
Engagespot supports a built in webhook provider to enable webhook notifications from your applications.
Unique Identifier
Each provider is identified by a unique identifier. Unique identifier of Default webhook provider is default_webhook
Enabling Default Webhook Provider
To enable default web push provider, login to your Engagespot dashboard, goto Channels -> Webhook and enable Default Provider. when enabling default webhook you can provide an Optional signing key that is used to sign the webhook body and attached to the X-WEBHOOK-SIGNATURE header.
User Profile Requirement
Webhook uses webhookUrl attribute in your user's profile as the primary address to deliver the notifications. So make sure your user's profile has the webhookUrl attribute set.
How set webhookUrl attribute in user's profile.
You can add webhookUrl attributes to your user's profile either via REST API or our front-end libraries (For example - ReactJS or Core Javascript).
From front-end library
Make sure you have authenticated the front-end library properly.
- Javascript Core
const engagespotClient = new Engagespot('API_KEY', {
userId: '123e4567-e89b-12d3-a456-426614174000',
});
engagespotClient.setProfileAttributes({
webhookUrl: 'your webhook url',
});
This will add discor attribute to your user's (123e4567-e89b-12d3-a456-426614174000) profile.
From backend library or REST API
You can use the PUT method on /users end point or PUT method of /profile endpoint in the REST API to update your user's profile.
Read API Docs for more information.
- Node
- cURL
import { EngagespotClient } from '@engagespot/node';
const client = EngagespotClient({
apiKey: 'ENGAGESPOT_API_KEY',
apiSecret: 'ENGAGESPOT_API_SECRET',
});
client.createOrUpdateUser('identifier', {
webhookUrl: 'your webhook url',
});
curl --location --request PUT 'https://api.engagespot.co/v3/users/{identifier}' \
--header 'X-ENGAGESPOT-API-KEY: ENGAGESPOT_API_KEY' \
--header 'X-ENGAGESPOT-API-SECRET: ENGAGESPOT_API_SECRET' \
--header 'Content-Type: application/json' \
--data-raw '{
"webhookUrl": "your webhook url"
}'
Alternatively, you can use PATCH method on /profile endpoint which uses JSON Patch syntax to do complex operations on your Profile object.