Skip to content

Latest commit

 

History

History
133 lines (99 loc) · 6.53 KB

File metadata and controls

133 lines (99 loc) · 6.53 KB

cmem-plugin-mattermost

Send messages to Mattermost channels and users.

eccenca Corporate Memoryworkflow pypi version license poetry ruff mypy copier

Development

  • Run task to see all major development tasks.
  • Use pre-commit to avoid errors before commit.
  • Agent instructions and skills for this project are in .claude/ - your own instructions belong in CLAUDE.md, which is never overwritten.
  • This repository was created with this copier template.

Plugin Usage

This plugin allows sending messages, to channels or/and users via a defined bot, in Mattermost.

The plugin can be used as a workflow plugin. For execution, it needs the url of the own mattermost server, an access token and the display name or name of the bot that should send the messages.

Parameters

Parameter Description
url The URL of the Mattermost server to which the plugin should connect.
access_token The access token of the bot that will be used to send the messages.
bot_name The bot account that sends the messages, named by its username, nickname, email address or full name.
user The single user account that receives the message as a direct message, named by username, nickname, email address or full name.
channel The single channel that receives the message, named by its name or its display name.
message The message text, interpreted by Mattermost as Markdown.

Execution

A recipient and a message configured on the task itself are sent once, before any entity is read. Entities arriving on the input port carry the paths user, channel and message, and each one is sent as a message of its own. Configuring a message on the task while entities also arrive sends both.

Running Test

To run a mattermost orchestration locally, you can use task:

task mattermost:start
task mattermost:db:load

On PyCharm

If you want to use single test run pytest have to be configured. Set the working directory under following path, to the one who the repository is on your local machine.

Edit Configuration -> Edit Configuration Templates -> Python Test -> Autodetect -> Working Directory

If you want to run a local test environment with cmem-orchestration you have to connect the Docker container in one network.

docker network connect dockerlocalhost_default docker-mattermost-1
docker network inspect dockerlocalhost_default

To set the URL parameter, copy the IP address of the docker-mattermost-1 container and append :8065 to the end. This will create the appropriate URL for accessing Mattermost on the local environment.

Mattermost Test Environment

Bot-account

Name:           "plugin-test"
Access-token:   <bot-access-token>

Admin account

Name:       "cmempy-developer" 
Password:   "cmempy-developer" 
Email:      "cmempy-developer@eccenca.com" 
User ID :   "hruniqwds7gg5bcm5fmn931iih"

User accounts

Name:       "user0example" 
Password:   "Password0" 
Email:      "user0@example.com" 
User ID :   "r3qsjphq97fatecdtye9kmeijw"

Name:       "user1example"
Password:   "Password1"
Email:      "user0@example.com"
User ID :   "36itfo66b7dyxc9x9nec4pssoc"

Name:       "user2example"
Password:   "Password2"
Email:      "user2@example.com"
Firstname:  "User"
Lastname:   "Eample2" 
Nickname:   "userex2" 
User-ID :   "z85twbta8b8bpe3qaf7n3iecwa"

Name:       "user3example"
Password:   "Password3"
Email:      "user3@example.com"
Firstname:  "User"
Lastname:   "Eample3"
Nickname:   "userex3"
User-ID :   "3j4wossgfirburd63ftd5mq16c"

To make and save custom settings, as well as start and close the Docker container, the following task commands are available:

task commands description
mattermost:db:dump Dump the mattermost database to volume/db.sql
mattermost:db:load Load the mattermost database from volume/db.sql
mattermost:start Start or restart the mattermost orchestration
mattermost:stop Stop the mattermost orchestration