Posting incoming webhook messages from a bot account

I’ve successfully set up an incoming webhook, and it posts from my user with the BOT label as documented. But I’d prefer that the webhook post as a dedicated user. I’ve created a new bot account for this purpose, but I see no way to configure the webhook to post as that bot account instead of from my account. Am I missing something? Thanks.

As far as I’m aware you should be able to do what your asking about. I briefly looked it up on the Mattermost documentation, and saw that the command below is provided to use for verifying a bot account has successfully been created:

curl -i -X POST -H 'Content-Type: application/json' -d '{"channel_id":"<channel-id>", "message":"This is a message from a bot", "props":{"attachments": [{"pretext": "Look some text","text": "This is text"}]}}' -H 'Authorization: Bearer <bot-access-token>' <mattermost-url>/api/v4/posts

Have you read the documentation here?

1 Like

The linked doc says,

Only user accounts can create and configure webhooks and slash commands.

This just looks odd.

At laeast the feature request seems to exist.

Allow bot accounts to create webhooks – Mattermost Feature Proposal Forum (

Hi Mekst and welcome to the Mattermost forums!

An incoming webhook is something that you create for yourself, usually, at least per definition. A webhook is always assigned to a userid and when using the GUI, the userid cannot be modified since it’s inherited from the user creating the webhook because a webhook needs to know what permissions it has. You cannot create a webhook with your user account which is able to post into a private channel you’re not a member of, that’s why. Using the API or the tool mmctl, you can create an incoming webhook which is assigned to a bot account. All you need to know for that is the bots userid and then you can run the following command:

mmctl webhook create-incoming  --channel <channel-id> --user <user-id>

The webhook will be assigned to the account/bot with userid “” then and posts will also show as appearing from this account (+ the bot label next to it).
Please keep in mind that the permission topic I mentioned earlier also applies here, so in order for the webhook to work, make sure that the bot account is allowed to post to the channels you want the webhook to post to.
If the webhook is locked to a channel, just make sure that the bot is a member there, this works always.
If you want the webhook to post to different public channels, you can assign the privilege post:channels to the bot account using the GUI, this will allow the bot to post to all public channels (even if it is not a member of the channel). The privilege post:all allows the bot to also send direct messages to other users and post to private channels where it is a member of.

Hope that helps!