4 ms·
How to build your own Slack integration
- mijustin 11y agoDidn't know about the reply function in Slack's API. This would allow you to send a private message to the user in the #general channel, correct? I can see that being super helpful with a few integrations I'm thinking about.
- phoenixbox 11y agoIts actually the reply handler provided within Hapi, which lets you reply to the request. For error handling, instructive messages and private messages we use the reply handler to push messages back to the user in the slack channel, visible only to them. Its super handy to cut down on "noise" in the channel but you do lose the rich formatting options in messages. If the request is coming from the #general channel then that would work, alternatively you would have to build up a separate request using superagent or something
- phoenixbox 11y agoHey there, this post came from our experience building Partyline, a Slack integration to manage project management tools. If anyone has any questions about how we approached building it let us know, we've learned some things along the way, adopting a pattern to make future integrations with GitHub, Trello etc. follow a similar interface. Building for Slack is awesome. Is anyone else currently building Slack integrations? For local development have you used a secure tunnel service?(ngrok or other) It would be interesting to hear about other peoples dev workflows with Slack. Partyline is all JS with Hapi.js, using ngrok to help in local dev. We <3 Slack :)
- wonkaWonka 11y agoAlso: curl -s -o /dev/null --data ' ...the message you were sending... ' https://??? the team subdomain ???.slack.com/services/hooks/slackbot?token=**** the slackbot api token for the channel ****&channel=%23channel??? ...have to debug your API token, before you can integrate with it, right?
- phoenixbox 11y agoHey, not quite sure what the question is, can you rephrase it? Requests to slack require the slack token to be included in the request params ``` qs: { "token": integration.get('slack_token'), "channel": integration.get('channel_id'), "username": 'Partyline', "attachments": JSON.stringify(attachment), "icon_url": SLACK_BOT_ICON, }, } ```