Webhooks
Pushback uses webhook events to POST data to your server when a user interacts with your messages. In order to receive events you'll need to specify a webhook endpoint for each channel.
To set a webhook endpoint:
- Click a channel in the sidebar
- Select the channel tab on the top navigation
- Enter webhook endpoint
- Click save
Pushback uses graphql to allow you to explore the data with graphiql that will be posted to your webhook endpoint. You can even modify it so you only get the data you're interested in.
Currently there is a messageSent
event and a replySent
event. They both show up in the graphiql editor, but they are separte POST requests to your server. Only one of the fields will be populated when a event is executed.
For example if you edit the graphql to include the messageSent
and replySent
, you'll receive message and reply events. If you're only interested in replySent
events, you would remove the messageSent
from the graphiql editor and click save.
{
# JSON object received when a message is sent, replySent will be null
messageSent {
id # Unique id for the message e.g. Message_122
title
body
}
# JSON object received when a reply is sent, messageSent will be null
replySent {
id # Unique id of the reply
text # the action the user pressed
message {
id # Unique id of the message that the reply is tied to e.g. Message_122
title
body
}
}
}
When a message is sent, the JSON payload will look like this:
{
"data": {
"messageSent": {
"id": "Message_122",
"title": "Hello world",
"body": "This is pushback"
},
"replySent": null,
}
When a reply is sent, the JSON payload will look like this:
{
"data": {
"messageSent": null,
"replySent": {
"id": "Reply_1",
"text": "Hi",
"message": {
"id": "Message_122",
"title": "Hello world",
"body": "This is pushback"
}
}
}
}