node-trello-slack icon indicating copy to clipboard operation
node-trello-slack copied to clipboard

Slack Incoming Webhooks service no longer uses Domain + Token

Open Wraithers opened this issue 10 years ago • 9 comments
trafficstars

Could you please look into updating the dependency on node-slack, and maybe move to slack-node, which has updated to allow for the new Webhook URL method of communicating with Slack?

It would require a couple of changes to trello-slack.js & config.json as well, which I tried doing myself, but couldn't get working.

Cheers!

Wraithers avatar Mar 30 '15 09:03 Wraithers

Sure, I will be happy to do that when I get some time. We don't have any problems with it as-is, but I imagine we may be grandfathered in if it no longer works that way for new accounts or something.

Unfortunately I'm under some time crunch with work projects so I may not be able to get to this for several weeks. Pull requests welcome, though. :)

atuttle avatar Mar 30 '15 13:03 atuttle

In the new URL format, https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX, the token is that final string (XXXXXXXXXXXXXXXXXXXXXXXX in the example). It's not obvious, but it does appear to work with the current configuration.

stvnrlly avatar Mar 30 '15 15:03 stvnrlly

Hello @stvnrlly !

I have been trying to make this work for about two days and I'm not having success.

Please, can you share your configuration/script (without real data) so I can test it to see what is wrong here ?

douglas avatar Mar 30 '15 20:03 douglas

Hey, I made a crude update to this and uploaded to npm as n-trello-slack, so you can use the config.json file with an added 'webhook' field under 'slack'

Still new to this, so haven't got around to cleaning it up and making a pull-request.

Wraithers avatar Mar 30 '15 20:03 Wraithers

Hey, my last message was a bit vague and not entirely helpful.

Take a look at my revised repo at https://github.com/Wraithers/node-trello-slack/tree/master Maybe you folks can help me figure out what I can improve before making a pull request.

It's not working locally using foreman, so might be better to use just 3 files from it: the index.js & Procfile files, along with the package.json file, but updated to include n-trello-slack as a dependency. Then git init, commit, deploy to heroku & scale a dyno.

Hope this helps!

Wraithers avatar Mar 30 '15 21:03 Wraithers

@douglas For a webhook that looks like https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX and a Slack team with the URL https://subdomain.slack.com, it looks something like this:

var Bot = require('node-trello-slack');
var bot = new Bot({
        pollFrequency: 1000*60*3, //every 3 minutes
        start: true,
        trello: {
            boards: ['board1','board2'],
            key: 'key',
            token: 'token',
            events: ['createCard','commentCard','addAttachmentToCard','updateCard','updateCheckItemStateOnCard']
        },
        slack: {
            domain: 'subdomain',
            token: 'XXXXXXXXXXXXXXXXXXXXXXXX',
            channel: '#channel'
        }
    });

At first, I didn't think that it was working because it didn't immediately pick up the current state of the boards. Once I made a change to one of them, though, it sent a hook into Slack.

stvnrlly avatar Mar 31 '15 01:03 stvnrlly

Thanks @stvnrlly ! I tried your approach and it did not worked for me =(

@Wraithers It worked perfectly ! Thank you so much for your message - the code is already deployed to heroku and working as expected ^^

Thanks a lot, guys ! You really rock =)

douglas avatar Mar 31 '15 18:03 douglas

Glad to hear that @douglas :smiley: Hope I can further clean it up and make a pull request at some point.

Making some personal changes to use env variables right now - learning is fun! :+1:

Wraithers avatar Mar 31 '15 21:03 Wraithers

@Wraithers Would love a pull request if you get a chance. :)

atuttle avatar May 12 '16 13:05 atuttle