Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use slack notification #20

Closed
lyrixx opened this issue Nov 10, 2014 · 14 comments
Closed

Unable to use slack notification #20

lyrixx opened this issue Nov 10, 2014 · 14 comments
Labels

Comments

@lyrixx
Copy link
Contributor

lyrixx commented Nov 10, 2014

I'm unable to set-up slack notifications.
I can do anything, the log output is always

INFO[0015] Slack notification sent.

(I try with a wrong token).

So it's not easy to debug...

@darkcrux darkcrux added the bug label Nov 11, 2014
@darkcrux
Copy link
Contributor

Seems like a bug. Will check it out.

@darkcrux darkcrux added bug and removed bug labels Nov 14, 2014
@darkcrux
Copy link
Contributor

hi @lyrixx Just released the v0.1.2 and we now have a better error message for slack. Thanks for this.

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

OK, I will try this ASAP ;)

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

So I tested it, and now in the log I got:

time="2014-11-14T09:49:22Z" level="info" msg="Unable to notify slack: No hooks"

Do you have an idea?


I have create a token on https://api.slack.com/
I have tested it on https://api.slack.com/methods/chat.postMessage/test and it worked well.

@darkcrux
Copy link
Contributor

Might be possible that you configured it wrong? I got this error when I had the wrong token. Slack's a bit tricky to get running as the return message from their API is pretty vague. My bet is it can be the token, or some other variable that's part of the hook URL.

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

I try to rebuild the token, and I got the same result. I googled this error and some people are talking about room_id and not room_name.

I filled all theses information: What is really mandatory / optional ?

screenshot-consul - mozilla firefox-1

@darkcrux
Copy link
Contributor

The cluster-name is surely optional, it's just there for better message formatting to Slack.

channel is probably the room_id/room_name they are talking about. During webhook integration setup, you can set this to a default channel. So this is required if that has not been setup yet.

icon-emoji is optional.

token is required.

username can be optional. it's the username that the hook will use.

Basically what the slack notifier does is send a payload to this url:

https://{{ team }}.slack.com/services/hooks/incoming-webhook?token={{ token }}

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

I don't understand why it did not work. I try to curl it manually:

(I copied it from https://api.slack.com/)

>(18)[~] curl -X POST https://sensiolabs.slack.com/services/hooks/incoming-webhook?token=xoxp-XXXXXXXXXXXXXXXXXXXXX
No hooks>(18)[~] 
>(18)[~] curl -X POST https://SensioLabs.slack.com/services/hooks/incoming-webhook?token=xoxp-XXXXXXXXXXXXXXXXXXXXX
No hooks>(18)[~]

@darkcrux
Copy link
Contributor

I tried it with ours and it seems to work. It might be the token.

$ curl -X POST https://acaleph.slack.com/services/hooks/incoming-webhook?token=xxxxxxxxxxxxxxxxxxxxxxxx
No payload received

The last time I got a No hooks error was when I got the token wrong.

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

I open an issue in slack

I tried to set-up consul-alerts communication with slack and I'm not able to do it. See the issue for more information about the product: https://github.com/AcalephStorage/consul-alerts/issues/20

So I tried to debug it a bit with curl:

curl -X POST https://SensioLabs.slack.com/services/hooks/incoming-webhook?token=xoxp-xxxxxxxxxxxxx -H "Host: SensioLabs.slack.com"
No hooks

I got my token and the team name on https://api.slack.com/

As you can see the repository owner tried also and he got "no payload".

I'm not sure but I guess it could be an issue with our team name. In your database, the team name is "SensioLabs". But, May be, when the HTTP request hit your application, the hostname is converted to lower case, and so I'm not fully authenticated?

Can you help me with that?

But I don't understand someting with your URL. I'm not able to find the documentation about it, and It don't understand why you don't use the "regular" API documented there https://api.slack.com/methods/chat.postMessage ?

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

hmm, I understand What I did wrong. I will submit a (doc) PR to your repository to help others user (after lunch) ;)

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

Voila, I just open a PR: #23

@darkcrux
Copy link
Contributor

Cool. Thanks. Merged. :)

@lyrixx
Copy link
Contributor Author

lyrixx commented Nov 14, 2014

Wahoo, So fast ;) I hope It will help new comers ;)

@lyrixx lyrixx closed this as completed Nov 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants