Webhooks are a powerful, yet little known feature of Respoke.
When events happen in your app - like endpoints joining or leaving a group - you can get notified via webhook.
For fast local development, this example will use ngrok to tunnel a port on your localhost to a subdomain of ngrok. This lets Respoke send you webhooks on https://your-custom-subdomain.ngrok.com and the requests are proxied to your local machine.
Download ngrok and take note of where you put the ngrok
file.
To get started, go the the Respoke dev portal and create a new app.
Then navigate down to the Webhooks section.
Put in your webhook endpoint and hit Update.
If you're using ngrok
, just make up something like https://actual-cannibal-shia-labeouf.ngrok.com
.
An example webhook server is on the Respoke GitHub:
git clone https://github.com/respoke/example-webhook-nodejs-server
cd example-webhook-nodejs-server
npm install
npm start
The server will run on http://localhost:3009 and print incoming webhooks.
cd path/to/ngrok/folder
./ngrok --subdomain=actual-cannibal-shia-labeouf 3009
This tells ngrok
to tunnel all requests to https://actual-cannibal-shia-labeouf.ngrok.com
to your localhost:3009
.
Next, do something that initiates some Respoke activity. You could clone the web examples and set them up to use your appId
.
That's really all it takes to start responding to webhooks.