Subscribing to events
If you want to build your own integrations, you can quickly subscribe to Papercups events (e.g. message:created
) via webhooks.
This page will walk you through setting up your own webhook URL. Let's get started!
#
Step 1: Go to the Integrations pageAfter logging in, navigate to the Integrations page to get started: https://app.papercups.io/integrations
#
Step 2: Click "Add webhook URL"Click the "Add webhook URL" to open the modal which will guide you through setting up your first webhook URL.
#
Step 3: Enter your webhook URLEnter the URL that you would like Papercups to notify of new events. After you enter a URL, we will attempt to verify it by sending it a POST request with a request body that looks like:
In order to get your URL verified, it will need to respond with the randomly generated string in the payload
. In a NodeJS backend, this might look something like:
To quickly test that your endpoint is working as expected, the following cURL command should output PONG
. (Note that it assumes your endpoint is called /api/webhook
and is running on localhost:3000
. Be sure to change the URL below to whatever you're using!)
NB: In development, you may need to use a service like ngrok to test your webhook. URLs like http://localhost:3000/api/webhook
or 127.0.0.1/api/webhook
will not work.
#
Step 4: Respond to eventsThe following events will be sent to your webhook URL once it's verified:
message:created
- sent when a message is createdconversation:created
- sent when a conversation is createdconversation:updated
- sent when a conversation is updated (e.g. closed, assigned, etc)customer:created
(coming soon!) - sent when a customer is createdcustomer:updated
(coming soon!) - sent when a customer is updated
As an example, the message:created
event request body would look something like this:
To see some examples of webhook integrations, check out this demo: https://github.com/papercups-io/webhooks-demo