serverless / examples

Serverless Examples – A collection of boilerplates and examples of serverless architectures built with the Serverless Framework on AWS Lambda, Microsoft Azure, Google Cloud Functions, and more.
https://www.serverless.com/examples/
Other
11.45k stars 4.47k forks source link

Slack Bot example #12

Open nikgraf opened 7 years ago

nikgraf commented 7 years ago

Let us know if you interested to work on this. I comment here if one of the core-team is starting to work on it.

FLGMwt commented 7 years ago

Hi! I'd love to work on this : ) I've built 5+ HipChat integrations for my team over the past couple weeks and put this up: https://github.com/FLGMwt/serverless-csharp-hipchat

I've been working with C# and HipChat, but I'd be happy to port this to all the supported runtimes as well as to Slack (the integration model is almost identical).

christophgysin commented 7 years ago

Any update on this?

nikgraf commented 7 years ago

@FLGMwt sure, wanna submit a simple example with a Readme similar to the existing ones?

FLGMwt commented 7 years ago

Sure! I'll jump on this during the upcoming weekend.

kaihendry commented 7 years ago

It's quite easy to make a bot, you respond to the event and build some text and make a request, for example:

const fetch = require('node-fetch')
const FormData = require('form-data')
const form = new FormData()
form.append('payload', JSON.stringify({ channel: '#mychannel', username: 'lambdabot', text: text, icon_emoji: ':movie_camera:' }))
fetch('https://hooks.slack.com/services/API/KEY', { method: 'POST', body: form })
.then(r => callback(null, r.statusText), callback)
ptrivedi9400 commented 6 years ago

I already have one bot which I worked on with Readme. its not complex and can easily be shared if no one else is working or has worked on it. I am more than happy to share with team for review. Let me know. and as mention by @kaihendry yes its super easy to develop slack bot.