Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I did not find any issue for this matter and as the fix is quite small I did not created one.
TLDR
Changing the variable
botnametouserat line 682 of the notifications.py file fixes an issue where the username of a Mattermost notifications is always "Prefect Notifications" even if a botname value was set.Detailed explanation
When using Mattermost webhooks to send messages, the sender's username/botname displayed on the channel can be set as we which.


However, even when updating the botname section of the Mattermost block, the botname was :
Prefect Notifications.Screenshot of Mattermost block from Prefect UI
Screenshot of Mattermost instance
This string is declared in notifications.py file as the app_id of an AppriseAsset:
We'll get to this string later. In the Mattermost class of the same notifications.py file, a botname can be set:
and is later used in the NotifyMattermost class when calling its url() method:
However, in the apprise code, the botname variable doesn't exist in the url method. Instead, the botname value is inherited from the user variable:
Thus, the botname value is never filled with the value provided by Prefect as the self.botname doesn't exist. But when the botname is empty, a username must still be provided to Mattermost. In the send function, the username is set as self.user or self.app_id:
As such, the value specified earlier in the AppriseAsset was used and thus
Prefect Notificationswas the username used. Tests showed that changing the self.app_id value to another (when no botname was set) changed the username in the Mattermost notification.Tests also confirmed that changing the variable
botnametouserat line 682 of the notifications.py file allowed to chose the username of the Mattermost notification (withoutPrefect Notificationsoverwriting it).If you want to reproduce the issue, ensure integrations are allowed to replace the usernames in your Mattermost otherwise the name of the Mattermost user that created the webhook will be always used.