| 1 |
Mattermost Backend |
| 2 |
================== |
| 3 |
|
| 4 |
Requirements |
| 5 |
------------ |
| 6 |
- Mattermost with APIv4 |
| 7 |
- Python >= 3.4 |
| 8 |
- websockets 3.2 |
| 9 |
- `mattermostdriver <https://github.com/Vaelor/python-mattermost-driver>`_ greater than version 4.0 |
| 10 |
|
| 11 |
Installation |
| 12 |
------------ |
| 13 |
|
| 14 |
- ``git clone https://github.com/errbotio/err-backend-mattermost`` |
| 15 |
- Create an account for the bot on the server. |
| 16 |
- Install the requirements. |
| 17 |
- Open errbot's config.py: |
| 18 |
|
| 19 |
.. code: none |
| 20 |
BACKEND = "Mattermost" |
| 21 |
BOT_EXTRA_BACKEND_DIR = "/path/to/backends" |
| 22 |
|
| 23 |
BOT_ADMINS = ("@yourname") # Names need the @ in front! |
| 24 |
|
| 25 |
BOT_IDENTITY = { |
| 26 |
# Required |
| 27 |
"team": "nameoftheteam", |
| 28 |
"server": "mattermost.server.com", |
| 29 |
# For the login, either |
| 30 |
"login": "[email protected]", |
| 31 |
"password": "botpassword", |
| 32 |
# Or, if you have a personal access token |
| 33 |
"token": "YourPersonalAccessToken", |
| 34 |
# Optional |
| 35 |
"insecure": False, # Default = False. Set to true for self signed certificates |
| 36 |
"scheme": "https", # Default = https |
| 37 |
"port": 8065, # Default = 8065 |
| 38 |
"timeout": 30, # Default = 30. If the webserver disconnects idle connections later/earlier change this value |
| 39 |
"cards_hook": "incomingWebhookId" # Needed for cards/attachments |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
- If the bot has problems doing some actions, you should make it system admin, some actions won't work otherwise. |
| 44 |
|
| 45 |
Cards/Attachments |
| 46 |
----------------- |
| 47 |
Cards are called attachments in Mattermost. |
| 48 |
If you want to send attachments, you need to create an incoming Webhook in Mattermost |
| 49 |
and add the webhook id to your errbot `config.py` in `BOT_IDENTITY`. |
| 50 |
This is not an ideal solution, but AFAIK Mattermost does not support sending attachments |
| 51 |
over the api like slack does. |
| 52 |
|
| 53 |
APIv3 |
| 54 |
----- |
| 55 |
Use the APIv3 branch for that. It is no longer supported and not guaranteed to work! |
| 56 |
|
| 57 |
**Attention**: The `BOT_IDENTITY` config options are different for V3 and V4! |
| 58 |
|
| 59 |
Known issues |
| 60 |
------------ |
| 61 |
|
| 62 |
- Channelmentions in messages aren't accounted for (this is a possible issue but is unconfirmed) |
| 63 |
|
| 64 |
FAQ |
| 65 |
---- |
| 66 |
|
| 67 |
The Bot does not answer my direct messages |
| 68 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 69 |
|
| 70 |
If you have multiple teams, check that you are both members of the same team! |
| 71 |
|
| 72 |
Acknowledgements |
| 73 |
---------------- |
| 74 |
|
| 75 |
**Thanks** to http://errbot.io and all the contributors to the bot. |
| 76 |
Most of this code was build with help from the already existing backends, |
| 77 |
especially: ``https://github.com/errbotio/errbot/blob/master/errbot/backends/slack.py`` |