Send a message on ticket creation or update to a MS Teams channel
Project description
TracTicketMSTeamsDispatcher
NOTE: the code is tested on a Trac 1.5.x so it will work with python 3 but since I use features like F-Strings it wont with python 2.x out of the box!
The plugin has the intention to provide a way to send information about the creation or the change of a ticket to a service like MS Teams via a webhook. That said the name points out it's meant to work only for ms teams but that's not entirely true since we can send off information to any kind of webhook that expects a payload. Of course we need to define a well-formed payload for every service and so we started out with ms teams. In the future it might be possible to send a payload to discord or some other fanzy web api.
HINT: a proof of concept payload for discord is already in the code but not really useful at this stage.
Lets get back to what we can do at this point. After the installation of the plugin you should get a new plugin under the plugins section of the trac adminstration. If we enable the plugin we get a new administration page under the ticket system section called MS Teams Dispatcher
. There we can define our first webhook and save it. As soon as we got this we can use the checkbox Notify MS Teams
in the ticket properties to send off a payload when a ticket is created or changed. To see what values are set in the trac.ini and the admin page read the sections further down in this document.
install
-
clone repo or download the zip archive
$ git clone https://github.com/rosjat/TracTicketMSTeamsDispatcherPlugin.git
-
build a python egg
$ python setup.py bdist_egg
-
copy the egg file in you trac projects plugins folder
-
install it in site-packages with pip (you might use a venv when using this version). The example assumes that you are in the cloned directory.
$ pip install .
or from pypi$ pip install TracTicketMSTeamsDispatcher
-
reload trac
trac.ini settings
the Plugin will create a section called [msteams-dispatcher]
and create variables web_hook_x.name
, web_hook_x.url
, web_hook_x.type
under it. Where name is a pretty name displayed in the admin panel, url is the web hook url and type will be an identifier for the future were it will be possible to send payloads to other services like discord. the x will be replaced by a number like web_hook_1.name
this way we can store more then one web hook in th furture.
Also created under [ticket-custom]
will be:
- tmsd = checkbox
- ttmsd.label = Notify MS Teams
- ttmsd.value = 1
admin settings
there will be a section under Plugins to enable/disable the plugin. If enabled you get a subsection MS Teams Dispatcher
under section Ticket
.
In MS Teams Dispatcher
you can set a values for a web hook and save it. You can also add or delete a webhook if you dont want to send payloads to it.
TODO / Features
- Editable Templates for the webhook payload (still no really clue how to do it in a usable way lol)
- adding localization support for the payloads
- making the ship off of payloads async (dont know if this is possible)
- structure the package a little better
- adding some typing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for TracTicketMSTeamsDispatcher-0.6.1.dev0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f5d5d7aa531bdb18d93d80f79f0b597687721df9bb250f6fb86f3ac536d6146 |
|
MD5 | 38f6c1bad4933739e5f27b21bf16d473 |
|
BLAKE2b-256 | 1b93f4361305e7194ad7425c1db2881ab2aebc953d0d25b092532b0490a0e48a |
Hashes for TracTicketMSTeamsDispatcher-0.6.1.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 175e5d0996d4725d292aa705d24054b9d578a4754fa7fac0e46f1d5d7572d7e9 |
|
MD5 | 03897efbb4ef260dd446dcf9c09e019e |
|
BLAKE2b-256 | 8cb3bb34d623ccd5fda66bff54cb76554f2e875c4173241c8f88a6fba412f47d |