In the payload of an incoming webhook, specifying a user results in error 500 “Couldn’t find the channel”
Steps to reproduce
Create incoming webhook
Open Firefox (or web browser with capability to POST and pass parameters)
Use the URL of the webhook and post the suggested example in the documentation (Make sure to put application/json in the content type of the header): {"text": "Hello, this is some text."}
Message should appear in the channel
Try again, but now add the channel property {"channel":"@username","text": "Hello, this is some text."}
Enter a valid user name in @username (leave the @ sign).
Post will now fail with a 500 error and message “Couldn’t find the channel”
Changing channel property to a public channel works. Only with @username is not working.
Expected behavior
As per documentation, “the message will be sent to that user’s direct message channel”
Observed behavior
Returned JSON: {"id":"web.incoming_webhook.channel.app_error","message":"Couldn't find the channel","detailed_error":"","request_id":"8aajaxpkybn8mmm7t4nkefnrca","status_code":500}
Also, misspelling the username or putting an invalid username results in “Couldn’t find the user”. So maybe the problem is that there’s no “channel” message for the user (as in Slack, the user can have private messages with themselves)
Hi
Yes. If it’s a slash command, and I use ephemeral then the user gets the message in whatever channel they’re in. But a incoming webhook cannot direct a message to specific user. Directing it to a channel works like a charm. I would suggest that the documentation gets updated, because it looks like it’s possible to send the message to a user.
The reason why I discovered this is because I’m creating a “reminder” bot (similar to the one in Slack). But because the post cannot be directed to a user, I can only create reminders for the channel.
I wanted to get involved in the development (I think Mattermost is an amazing app) but I don’t know how to program in Go. Maybe if I have some time I’ll study it. Mostly I wanted to get involved because I see that some features (of the same JSON payload) work under some features and not under another (like attachments do not work in slash commands but work in incoming webhooks). I wanted to consolidate the processing and posting of a JSON payload so that any feature that gets added/supported works in all places that it is used.
OK so for now, this is not possible (from a webhook to send the message to specific user)
Thanks
Ahhh…OK I see.
I was testing it with myself. That’s why it was not working.
Alright, I’ll give it a try with a different user and see what happens.
Thanks!
One last thing: It can only post to the channel of other users only if there’s a channel for private messages between the target user and the creator of the webhook.
If those users have never talked privately before, the channel doesn’t exists and we get the same error 500.
Do I understand it correctly that an incomming webhook can only devliver messages to private messages the creator of the webhook is part of? So it cannot post to any private message scenario as another user?
Can it post to a private channel, the creator is not part of?
To clarify, I’m using a slash command (so everyone can trigger it everywhere) and then try to get the response back via an incomming web hook (because slash commands dont support attachments).
In version 3.4 that was the case. To overcome that part, in my implementation the slash commands posts a link to my web interface that has the files (I was also dealing with attachments among other things)
It seems like version 3.6 might support attachments or some form of it now. I noticed that a slash command we had from our time with Slack is now bringing the extra data that we sent as attachments, which was not doing before.
I cannot confirm that.
I’m using 3.6 and I cannot send an over an incomming webhook to private message channels. Only to those where the creator of the webhook is part of.
Everything else gives me an
code=500 … Inappropriate channel permissions [details: ]
Yes, that is still an issue. I was referring to the original reason why you did this, which is, the lack of attachments. That seems to be available now.
This is a slash command in our organization that provides the license code for customers. We created it while using Slack. When we moved to Mattermost the “Customer Code” and “Customer Name” were not coming. We were OK because we just needed the code.
Now, in 3.6 they’re coming in nicely like it did in Slack
I’m having the same issues with a slash command only working where the creator (me) is a part of the channel. It is not working for 2 other users when I’m not involved.
Did you solve this issue? If so, how? I was a little confused how attachments might solve your problem.
Yes it is working now. I am not sure any more, what it really was but I think it had to do with https somehow.
I registered myself another user that was not admin and tested it with that account. Also look up the log, there should be an error message.