Mattermost does not send to selected channel
:mega: Notification Service(s) Impacted Mattermost
:lady_beetle: Describe the bug I want to send a Mattermost notification to a specific channel. According to the instructions, this URL should work:
mmost://my_username@mattermost:8065/my_token?channels=my_channel
However, it doesn't work. The correct username is used ("my_username"), but the notification is sent to the channel selected here (in this case, the "Town Square"):
Note that "Lock to this channel" is not selected. In fact, this works correctly (to the correct channel) if I send the request manually:
curl -i -X POST --data-urlencode 'payload={"username": "my_username", "channel": "my_channel", "text": "Hello, this is some text :tada:"}' http://mattermost:8065/hooks/my_token
Given that the curl request works, this seems to be an Apprise issue...
Interestingly, I looked at the source code and it seems that mmost://my_username@mattermost:8065/my_token?to=my_channel works, which is surprising.
The payload places the channel there; see line 220 just as you're doing with your curl example.
If you run the the Apprise CLI with -vvv , does the debug output give any more hints as to what is going on?
HI, can you please provide an update to this? :pray:
Hi, I have the same problem and would love to jump in to provide the troubleshooting information. I like your project and you do a great job.
root@***:/# apprise --body="Test Message" mmosts://user@mattermost:443/mytoken?to=mychannel -vvv 2024-08-05 08:14:35,702 - DEBUG - Language set to en 2024-08-05 08:14:35,823 - DEBUG - Notification Plugin 104(s) and 148 Schema(s) loaded in 0.1186s 2024-08-05 08:14:35,823 - DEBUG - Loaded Mattermost URL: mmosts://user@mattermost/mytoken/?image=no&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes&channel=mychannel 2024-08-05 08:14:35,823 - DEBUG - Mattermost POST URL: https://mattermost:443/hooks/mytoken (cert_verify=True) 2024-08-05 08:14:35,823 - DEBUG - Mattermost Payload: {'text': 'Test Message', 'icon_url': None, 'username': 'user', 'channel': 'mychannel'} 2024-08-05 08:14:36,099 - INFO - Sent Mattermost notification to channel mychannel.
root@***:/# apprise --body="Test Message" mmosts://user@mattermost:443/mytoken?channels=mychannel -vvv 2024-08-05 08:15:10,787 - DEBUG - Language set to en 2024-08-05 08:15:10,911 - DEBUG - Notification Plugin 104(s) and 148 Schema(s) loaded in 0.1218s 2024-08-05 08:15:10,911 - DEBUG - Loaded Mattermost URL: mmosts://user@mattermost/mytoken/?image=no&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes 2024-08-05 08:15:10,911 - DEBUG - Mattermost POST URL: https://mattermost:443/hooks/mytoken (cert_verify=True) 2024-08-05 08:15:10,911 - DEBUG - Mattermost Payload: {'text': 'Test Message', 'icon_url': None, 'username': 'user'} 2024-08-05 08:15:11,217 - INFO - Sent Mattermost notification.
As you can see the channel payload is missing with the channels tag. Hope this helps.
Edit: Found the cause: The tag has to be channel and not channels and it works like a charm. Maybe you could adapt the wiki (https://github.com/caronc/apprise/wiki/Notify_mattermost) because it states channels. On the project root page it's correct: mmost://hostname/authkey?channel=channel
I'm sorry it took so long to action this for you all. I was able to reproduce this, and fix it in the attached PR. I added a test case to cover this for future references too.