How to build your own Slack integration
sprint.ly
sprint.ly
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?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, }, } ```
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 :)
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.
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