Mattermost bot seems to be forbidden, but it is not

Describe the issue/error/question

I’m trying to setup a mattermost auth for a bot user. Note that the issue I’ll discuss here is not present with regular (user) accounts, but happens only for bots.

After creating a bot account, I generate an access token and save it in n8n credentials.
Then, I add a mattermost node and try to send a message using those credentials.

In the Channel ID field, n8n complains that the user is not authorized with the error message reported below.
But the token is actually working from the very same node: if I set a channel id (with the bare string), I can execute the node and I correctly receive the message in mattermost.

Therefore, the credentials do work.

It seems there is an issue with the UI alone, when trying to retrieve the channels list, but the auth is actually valid.

I’m not sure what’s the proper way to verify what request is performed by the UI and check if there is something wrong with it.

What is the error message (if any)?

Issues:
  - There was a problem loading the parameter options from server: "Forbidden - perhaps check your credentials?"

Please share the workflow

{
  "nodes": [
    {
      "parameters": {
        "channelId": "abc123abc123abc123abc123ab",
        "message": "Test message",
        "attachments": [],
        "otherOptions": {}
      },
      "name": "Mattermost",
      "type": "n8n-nodes-base.mattermost",
      "typeVersion": 1,
      "position": [
        -40,
        460
      ],
      "credentials": {
        "mattermostApi": {
          "id": "14",
          "name": "Mattermost Bot Auth"
        }
      }
    }
  ],
  "connections": {}
}

Information on your n8n setup

  • n8n version: 0.156.9
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: docker

Think the issue is that the bit is allowed to post a message but not to query the channels. For that reason will it work fine when you execute the node but display the error on the channel parameter where it tries to resolve the name.

Thank you for the answer, I’ll try to gather more details on how the request is performed and ask mattermost devs details about bot permissions.

1 Like