include message metadata in webhook/slash http requests to help tell bot messages apart from human messages
It is currently not possible for a webhook/slash command webservice (a bot) to tell whether a message came from another bot (or this bot) or from a human.
See also the GitHub discussion: https://github.com/mattermost/mattermost-server/issues/9719#issuecomment-438320149
Summary:
Even though it is usually possible to set the displayed username to an arbitrary value when programmatically creating a post, this username is ignored when the created message is sent out via a webhook, leaving a lot of opportunity for loops.
There are 4 ways new messages (posts) can be created:
- Human types them
- Incoming Webhook
- Outgoing Webhook bot response.
- API (Post)
All of these are slightly inconsistent in terms of what metadata can be set. For instance, only the POST API allows setting of "props" (a map of properties). It would be trivial for a bot to set "{bot: true}", but, alas, this property bundle is not included in any outgoing requests later made by Mattermost.
A related suggestion would also benefit from this change: https://mattermost.uservoice.com/forums/306457-general/suggestions/19376305-allow-webhooks-to-trigger-other-webhooks-posts (because enabling this would make loops very likely)
-
Akom commented
And of course there are other benefits to having arbitrary metadata on messages that can be accessed by integrations... the possibilities are endless.