{"id":19806532,"url":"https://github.com/danielchristianschroeter/mattermost-bot","last_synced_at":"2026-05-11T13:04:04.940Z","repository":{"id":65576190,"uuid":"516896481","full_name":"danielchristianschroeter/mattermost-bot","owner":"danielchristianschroeter","description":"Mattermost command bot written in Go","archived":false,"fork":false,"pushed_at":"2024-05-22T20:38:14.000Z","size":413,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-28T18:00:17.369Z","etag":null,"topics":["command-bot","go","mattermost-bot","openshift","terraform"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielchristianschroeter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-22T21:56:40.000Z","updated_at":"2024-05-22T20:38:12.000Z","dependencies_parsed_at":"2023-12-20T12:49:16.967Z","dependency_job_id":"1c06bef9-f38e-467f-9718-fee6b6646047","html_url":"https://github.com/danielchristianschroeter/mattermost-bot","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/danielchristianschroeter/mattermost-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielchristianschroeter%2Fmattermost-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielchristianschroeter%2Fmattermost-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielchristianschroeter%2Fmattermost-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielchristianschroeter%2Fmattermost-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielchristianschroeter","download_url":"https://codeload.github.com/danielchristianschroeter/mattermost-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielchristianschroeter%2Fmattermost-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32895978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["command-bot","go","mattermost-bot","openshift","terraform"],"created_at":"2024-11-12T09:07:49.824Z","updated_at":"2026-05-11T13:04:04.902Z","avatar_url":"https://github.com/danielchristianschroeter.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mattermost-bot\n\n### What is it ?\nmattermost-bot can join any Mattermost channel and watches for commands to execute them locally on the same host or call other remote API services. For security reasons, not all commands of all roles are available to use.\n\nUse `!help` to list all possible commands (depends on configured ROLES variable) you can use in the Mattermost channel:\n\n```\nThe following commands are availble to use:\n[OpenShift Client]\n!oc get     Display one or many resources\n!oc describe     Show details of a specific resource or group of resources\n!oc delete pod     Delete a pod\n!oc scale     Set a new size for a deployment, replica set, or replication controller\n!oc logs     Print the logs for a container in a pod\n!oc adm top     Show usage statistics of resources on the server\n!oc adm upgrade     Check on upgrade status or upgrade the cluster to a newer version\n!oc api-versions     Print the supported API versions on the server, in the form of group/version\n!oc api-resources     Print the supported API resources on the server\n!oc help     Help about any command\n!oc version     Print the client and server version information\n!oc options     List of global command-line options (applies to all commands)\n[Terraform]\n!terraform init     Prepare your working directory for other commands\n!terraform validate     Check whether the configuration is valid\n!terraform plan     Show changes required by the current configuration\n!terraform apply     Create or update infrastructure\n!terraform output     Show output values from your root module\n!terraform show     Show the current state or a saved plan\n!terraform version     Show the current Terraform version\nGlobal options:\n-chdir=DIR     Switch to a different working directory before executing the given subcommand.\n-help     Show help for a specified subcommand.\n-version     An alias for the version subcommand.\n[Terraform Wrapper]\n!tf plan \u003cENV\u003e \u003cZONE\u003e     Show changes required by the current configuration for a zone within an environment.\n!tf apply \u003cENV\u003e \u003cZONE\u003e     Create or update infrastructure for a zone within an environment.\n[Govc Client]\n!govc about     Display About info\n!govc cluster.usage     Cluster resource usage summary\n!govc datacenter.info     Information about datacenter\n!govc datastore.cluster.info     Display datastore cluster info\n!govc device.info     Device info for VM\n!govc events     Display events\n!govc find     Find managed objects\n!govc metric.sample     Display metrics of host\n!govc vm.info     Display info for VM\n!govc vm.power     VM power operations\nGlobal options:\n-help     Show help for a specified subcommand.\n```\n\nIf the output exceeds the message limit from Mattermost, the full output will automatically uploaded to a custom PrivateBin server (https://privatebin.info/).\n\n### Configuration\n\n`MB_DEBUG`: Show more details, for better debugging puposes you should enable this value.\n\n`MB_ROLES`: Define the roles you want to use, seperated by comma (Available roles are: govc, oc, terraform, tf)\n\n`MB_MATTERMOST_URL`: The Mattermost URL with protocol.\n\n`MB_MATTERMOST_USERTOKEN`: The Mattermost personal access user token of a user the application can use to watch for commands in a channel.\n\n`MB_MATTERMOST_TEAM`: The Mattermost team the user account is assigned to.\n\n`MB_MATTERMOST_CHANNEL`: The Mattermost channel where the bot should watch and response for commands.\n\n`MB_PRIVATEBIN_ENABLE`: Enable or disable (true/false) Privatebin (https://github.com/PrivateBin/PrivateBin), if the response exceeds 6315 characters. \n\n`MB_PRIVATEBIN_URL`: The URL of the Privatebin instance.\n\n`MB_PRIVATEBIN_FORMATTER`: You can define the Privatebin formatter. (Recommendation: syntaxhighlighting).\n\n`MB_PRIVATEBIN_EXPIRE`: Set the expire date when the links should be removed from Privatebin. (Recommendation: 6days)\n\n`MB_PRIVATEBIN_OPENDISCUSSION`: Enable or disable (true/false) opendiscussion for Privatebin link. (Recommendation: false)\n\n`MB_PRIVATEBIN_BURNAFTERREADING`: Enable or disable (true/false) burnafterreading for Privatebin link. (Recommendation: false)\n\n`MB_PRIVATEBIN_PASSWORD`: Set a Privatebin password for the generated link. (Recommendation: leave the value empty)\n\n`MB_GOVC_URL`: The URL of your vCenter Server Appliance.\n\n`MB_GOVC_DATACENTER`: Datacenter of your vCenter Server.\n\n`MB_GOVC_USERNAME`: Username with proper permissions to control vCenter Server.\n\n`MB_GOVC_PASSWORD`: Password from the vCenter Server user account definied above.\n\n`MB_TERRAFORM_EXECUTABLE`: Location of the terraform executable (https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)\n\n`MB_MB_TERRAFORM_WRAPPER_EXECUTABLE`: Location of the terraform wrapper script executable (misc/tf.sh)\n\n`MB_OC_EXECUTABLE`: Location of the OpenShift client executable (From your OpenShift Dashboard or https://github.com/okd-project/okd)\n\n`MB_GOVC_EXECUTABLE`: Location of the govc executable (https://github.com/vmware/govmomi)\n\nThe configuration is located in the `config.env` file (you can rename the sample file `config.env.sample`).\n\nThe application will automatically use the environment variables if present, otherwise it will use the values from the config.env file.\n\n### How you can build it?\n\nYou can build this Go project to a binary file on Ubuntu as follows:\n\n* Install go from https://go.dev/dl/\n* git clone https://github.com/danielchristianschroeter/mattermost-bot\n* cd mattermost-bot\n* go build .\n\nYou can also use the pre build binary from the releases page.\n\n### How to create a proper Mattermost account?\n\nJust create a normal user account for the bot (Bot Accounts are not working to read messages from a channel).\nIn the Profile page from this account, you need to create a \"Personal Access Token\". If you can not see this point in the Security menu, you have to enable this Option first in the System Console \u003e Integration Management \u003e Set \"Enable Personal Access Tokens\" to true.\n\n### How can you run it ?\n\nRename `config.env.sample` to `config.env`, update the configuration and put the config file in the same directory as the executable.\n\nExecute the mattermost-bot binary and see if the bot joining the defined Mattermost channel and respond to `!help`.\n\nIf you want to put the bot in the background, you can use the systemd example in `misc/mattermost-bot.service`.\n\nDepending on your needs, the mattermost bot maybe nrequires higher permissions to execute certain commands.\n\nI tested the Mattermost-bot ony with Ubuntu OS, but it whould work on other OS too.\n\n### Avilable roles\n\nAt the moment, you can use the following roles:\n\nterraform\ntf (custom bash wrapper script for Terraform `misc/tf.sh`)\noc\ngovc\n\nJust add or remove the role the bot should mange in the `ROLES=` variable in your configuration file or environment parameter.\n\nPlease note, the bot can only manage the role if the binary file and a proper configuration exist for that application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielchristianschroeter%2Fmattermost-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielchristianschroeter%2Fmattermost-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielchristianschroeter%2Fmattermost-bot/lists"}