Giter VIP home page Giter VIP logo

xmppwb's Introduction

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

Note: Python 3.5 is required. It will not work with Python 3.4 as xmppwb uses specific syntax that was introduced with Python 3.5.

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 -c CONFIG [-h] [-v] [-l LOGFILE] [-d] [--version]

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: <[email protected]>
  password: "<bot-password>"
  # Define all MUCs that should be available to the bridges defined later.
  mucs:
    - jid: <[email protected]>
      nickname: <nickname>
      # password: "<muc-password>"
incoming_webhook_listener:
  bind_address: "127.0.0.1"
  port: 5000
bridges:
  - xmpp_endpoints:
      - muc: <[email protected]>
    outgoing_webhooks:
      - url: <incoming-webhook-url-from-other-end>
    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>.

  1. 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.
  2. 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.
  3. 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/.
  4. Copy the token and fill it into the <outgoing-webhook-token-from-rocketchat> placeholder.
  5. 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>.

  1. 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.
  2. 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.
  3. 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/.
  4. After saving, copy the token and fill it into the <outgoing-webhook-token-from-mattermost> placeholder.
  5. 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.

xmppwb's People

Contributors

jonasob avatar saqura avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.