<img height="1" width="1" src="https://www.facebook.com/tr?id=772492926248011&amp;ev=PageView &amp;noscript=1">
Workplace WebHooks
Mark Wyman on Sep 1, 2017 10:28:52 PM

It's been way too long between posts, so I thought I would quickly share this one. I'm always spinning up new projects that utilise Workplace's WebHooks, yet I've never made it easy on myself, so I created a quick node module that bootstraps the process. All you have to do is specify the integrations App Secret, Access Token and WebHook Verify token, create your HTTPS server, and that's about it. After you register the events in Workplace, you just listen to the events in your app and do something with the data from Workplace. It's helped me get up and running quicker; hopefully, you might find it useful too.

Check it out on GitHub.

const spdy = require('spdy');
const WorkplaceWebhooks = require('@enablo/workplace-webhooks');

const app = workplaceWebhooks.express('App Secret', 'Access Token', 'Verify Token');

workplaceWebhooks.on('subscription', () => console.log('Webhook subscription successful.'));
workplaceWebhooks.on('security', (data) => console.log(data));
workplaceWebhooks.on('error', (err) => console.error(err.messsage));

spdy.createServer({ key, cert }, app)
    .listen(3000, () => console.log('Express app with HTTP/2 support running on port 3000.'));
Topics: Bots, WebHooks, Workplace

Subscribe to Email Updates