apprise icon indicating copy to clipboard operation
apprise copied to clipboard

Mattermost does not send to selected channel

Open truppelito opened this issue 2 years ago • 3 comments

: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"): Screenshot 2023-12-18 at 18 57 25

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...

truppelito avatar Dec 18 '23 18:12 truppelito

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.

truppelito avatar Dec 18 '23 18:12 truppelito

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?

caronc avatar Dec 18 '23 23:12 caronc

HI, can you please provide an update to this? :pray:

caronc avatar Dec 29 '23 21:12 caronc

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

elmosan avatar Aug 05 '24 08:08 elmosan

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.

caronc avatar Aug 05 '24 15:08 caronc