xmppwb - XMPP Webhook Bridge
Note that xmppwb is currently in early development and may contain bugs.
A bot that bridges XMPP (chats and MUCs) with webhooks, thus making it possible to interact with services outside the XMPP world. This can be used to connect XMPP to other chat services that provide a webhook API (for example Rocket.Chat or Mattermost).
Installation
xmppwb requires Python 3.5+ and can be installed using pip3:
$ pip3 install --upgrade xmppwb
which will automatically install the dependencies (aiohttp, pyyaml and slixmpp).
Usage
This bridge is meant to run on the same server as the application you are bridging with, as it currently uses HTTP for incoming webhooks.
To run the bridge:
$ xmppwb --config configfile.conf
or:
$ python3 -m xmppwb --config configfile.conf
Synopsis:
$ xmppwb [-h] [-v] -c CONFIG [-l LOGFILE] [-d]
See also xmppwb --help.
Configuration
Please see CONFIGURATION.rst for detailed documentation. A simple config file looks like this (the <placeholders> need to be changed):
xmpp:
# This JID must exist.
jid: <alice@example.com>
password: "<bot-password>"
# Define all MUCs that should be available to the bridges defined later.
mucs:
- jid: <conference1@conference.example.com>
nickname: <nickname>
# password: "<muc-password>"
incoming_webhook_listener:
bind_address: "127.0.0.1"
port: 5000
bridges:
- xmpp_endpoints:
- muc: <conference1@conference.example.com>
- relay_all_normal: true
outgoing_webhooks:
- url: <incoming-webhook-url-from-other-end>
override_username: "{nick}"
incoming_webhooks:
- token: <outgoing-webhook-token-from-other-end>
Note that the password is stored in cleartext, so take precautions such as restricting file permissions. It is recommended to use a dedicated JID for this bridge.
The terminology incoming and outgoing in the config file refers to webhooks from the perspective of this bridge. The webhooks must also be defined on the other end (Rocket.Chat and Mattermost provide a UI for this, for example). An outgoing webhook in Rocket.Chat must be set up in the incoming webhooks section in this bridge and vice versa.
Integrating with Rocket.Chat
An example config for bridging XMPP with Rocket.Chat is provided in rocketchat.example.conf. It is recommended to copy it and fill out all <placeholders>.
To create the corresponding webhooks in RocketChat, go to Administration->Integrations and create a new incoming webhook. Here you can select the channel that you want to bridge with.
After saving, a webhook URL will be generated. Copy it and fill it into the <incoming-webhook-url-from-rocketchat> placeholder in the config file.
Now create an outgoing webhook. The URL is of the form http://{bind_adress}:{port}/ and depends on your settings in the incoming_webhook_listener section. It defaults to http://127.0.0.1:5000/.
Copy the token and fill it into the <outgoing-webhook-token-from-rocketchat> placeholder.
After having filled out all other placeholders, the bridge is ready to run (see usage).
Integrating with Mattermost
An example config for bridging XMPP with Mattermost is provided in mattermost.example.conf. It is recommended to copy it and fill out all <placeholders>.
To create the corresponding webhooks in Mattermost, go to Account Settings->Integrations and create a new incoming webhook. Here you can select the channel that you want to bridge with.
After saving, a webhook URL will be generated. Copy it and fill it into the <incoming-webhook-url-from-mattermost> placeholder in the config file.
Now create an outgoing webhook. The callback URL is of the form http://{bind_adress}:{port}/ and depends on your settings in the incoming_webhook_listener section. It defaults to http://127.0.0.1:5000/.
After saving, copy the token and fill it into the <outgoing-webhook-token-from-mattermost> placeholder.
After having filled out all other placeholders, the bridge is ready to run (see usage).
License
xmppwb is released under the MIT license. Please read LICENSE for details.
Metadata
Release files for xmppwb 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xmppwb-0.2.6.tar.gz | 13.6 kB | Without provenance | Details for xmppwb-0.2.6.tar.gz |
Release files / xmppwb-0.2.6.tar.gz
| Download URL | xmppwb-0.2.6.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46bb2ca367b1532c4e718879c28909cf88cfc749559e5f40e44689e5a9ccf9fb
|
|
BLAKE2b-256 checksum How to use checksums |
d502d2ceaddd1fda2a852bf772ddf1bea9a40dd35407c91fa5024a5b01978fd8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for xmppwb 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.