Skip to content

respoke/example-webhook-nodejs-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example-webhook-nodejs-server

Processing Webhooks from Respoke

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.

Prerequesites

0. Download ngrok (optional)

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.

1. Configure your webhook

To get started, go the the Respoke dev portal and create a new app.

Then navigate down to the Webhooks section.

respoke dev portal webhook URL input

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.

2. Clone the repo and install

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

3. Run the webhook server

npm start

The server will run on http://localhost:3009 and print incoming webhooks.

4. Fire up the ngrok tunnel (optional)

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.

5. Receive webhooks

Next, do something that initiates some Respoke activity. You could clone the web examples and set them up to use your appId.

example webhook traffic

That's really all it takes to start responding to webhooks.

About

A Node.js server boilerplate for responding to Respoke webhooks.

Resources

License

Stars

Watchers

Forks

Packages

No packages published