{"id":13343184,"url":"https://github.com/nioc/xmpp-bot","last_synced_at":"2025-03-18T20:30:41.619Z","repository":{"id":41766386,"uuid":"214743949","full_name":"nioc/xmpp-bot","owner":"nioc","description":"XMPP Bot is a tiny little bot making the link between XMPP conversations and webhooks.","archived":false,"fork":false,"pushed_at":"2023-01-09T08:31:35.000Z","size":321,"stargazers_count":24,"open_issues_count":4,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-28T12:06:34.804Z","etag":null,"topics":["chatbot","muc","webhook","webhook-server","webhook-service","xmpp","xmpp-bot"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nioc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-13T01:46:08.000Z","updated_at":"2024-10-17T11:13:19.000Z","dependencies_parsed_at":"2023-02-08T09:31:41.035Z","dependency_job_id":null,"html_url":"https://github.com/nioc/xmpp-bot","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fxmpp-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fxmpp-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fxmpp-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fxmpp-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nioc","download_url":"https://codeload.github.com/nioc/xmpp-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243950792,"owners_count":20373664,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["chatbot","muc","webhook","webhook-server","webhook-service","xmpp","xmpp-bot"],"created_at":"2024-07-29T19:30:40.659Z","updated_at":"2025-03-18T20:30:41.350Z","avatar_url":"https://github.com/nioc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XMPP Bot\n\n[![license: AGPLv3](https://img.shields.io/badge/license-AGPLv3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)\n[![GitHub release](https://img.shields.io/github/release/nioc/xmpp-bot.svg)](https://github.com/nioc/xmpp-bot/releases/latest)\n[![Build Status](https://api.travis-ci.com/nioc/xmpp-bot.svg?branch=master)](https://app.travis-ci.com/github/nioc/xmpp-bot)\n[![Coverage Status](https://coveralls.io/repos/github/nioc/xmpp-bot/badge.svg?branch=master)](https://coveralls.io/github/nioc/xmpp-bot?branch=master)\n\nXMPP Bot is a tiny little bot making the link between XMPP conversations and webhooks.\n\nUser \u0026rlarr; XMPP client \u0026rlarr; XMPP Server \u0026rlarr; **XMPP Bot** \u0026rlarr; REST API\n\n## Key features\n\n-   Call outgoing webhook on XMPP incoming messages from user chat or group chat (Multi-user chat \"MUC\"),\n-   Send message templates (with values to apply to variables in that template) to user or room (MUC) on incoming authorized (basic or bearer) webhook.\n\n## Installation\n\nAn [Ansible role](/docs/ansible/xmpp-bot/README.md) is provided, but you can also use following commands: \n\n-   Install [Node.js](https://nodejs.org/):\n    ```shell\n    curl -sL https://deb.nodesource.com/setup_10.x | bash -\n    apt-get install -y nodejs\n    ```\n\n-   Install npm:\n    ```shell\n    npm install npm@latest -g\n    ```\n\n-   Clone repository:\n    ```shell\n    git clone https://github.com/nioc/xmpp-bot.git /usr/local/bin/xmpp-bot/\n    ```\n\n-   Install dependency:\n    ```shell\n    cd /usr/local/bin/xmpp-bot/ \u0026\u0026 npm install --production\n    ```\n\n-   Create run user (optionnal):\n    ```\n    useradd -r -s /bin/false xmpp-bot\n    chown xmpp-bot:xmpp-bot /usr/local/bin/xmpp-bot -R\n    ```\n\n-   Set [configuration](#configuration) in `/lib/config/config.json` (you can copy `config.json.dist`)\n\n-   Add systemd service from [model](/docs/xmpp-bot.service):\n    ```shell\n    cp docs/xmpp-bot.service /etc/systemd/system/xmpp-bot.service\n    ```\n\n-   Update systemd:\n    ```shell\n    systemctl daemon-reload\n    ```\n\n-   Start service:\n    ```shell\n    systemctl start xmpp-bot\n    ```\n\n-   Start service at boot:\n    ```shell\n    systemctl enable xmpp-bot\n    ```\n\n-   Add fail2ban filter from [model](/docs/xmpp-bot.conf) (optionnal):\n    ```shell\n    cp docs/xmpp-bot.conf /etc/fail2ban/filter.d/xmpp-bot.conf\n    ```\n    Add the jail (`/etc/fail2ban/jail.local`):\n    ```properties\n    [xmpp-bot]\n    enabled  = true\n    port     = http,https\n    filter   = xmpp-bot\n    logpath  = /var/log/xmpp-bot/webhook.log\n    maxretry = 3\n    bantime  = 21600 ; 6 hours\n    ```\n\n## Configuration\n\n### Logger\n\n-    `level` log4js level (all \u003c trace \u003c debug \u003c info \u003c warn \u003c error \u003c fatal \u003c mark \u003c off)\n-    `file`, `console` and `stdout` define log appenders (see [log4js doc](https://log4js-node.github.io/log4js-node/appenders.html))\n\n### Webhooks listener\n\n-    `path` and `port` define the listening endpoint\n-    `ssl` define key and certificat location and port used for exposing in https, make sure that user of the process is allowed to read cert\n-    `users` is an array of user/password for basic authentication\n-    `accessLog` define the listener logger\n\n### XMPP Server\n\n-    `service` and `domain` define XMPP server\n-    `username` and `password` define XMPP \"bot\" user credentials\n-    `rooms` list rooms (and optionnal password) where bot will listen\n\n### Incoming webhooks (list)\n\n-    `path` is the webhook key:a POST request on this path will trigger corresponding `action`\n-    `action` among enumeration:\n     -    `send_xmpp_message` will send message (`message` in request body) to `destination` (from request body) ; if `destination` is found in `config.xmppServer.rooms` array, message will send as a groupchat). Request exemple:\n\n            ```http\n            POST /webhooks/w1 HTTP/1.1\n            Host: domain.ltd:8000\n            Content-Type: application/json\n            Authorization: Basic dXNlcjE6cGFzczE=\n            Content-Length: 70\n\n            {\n                \"destination\":\"me@domain.ltd\",\n                \"message\":\"Hi, there something wrong.\"\n            }\n            ```\n\n     -    `send_xmpp_template` will send template with merged variables (using JMESPath) to `destination` (user or room if `type` set to `chat` or `groupchat`)\n\n### XMPP hooks (list)\n\n-    `room` is the XMPP hook key: an incoming groupchat (or chat) from this room (or this user) will trigger corresponding `action`\n-    `action` among enumeration:\n     -    `outgoing_webhook` will execute a request to corresponding webhook with `args` as webhook code\n\n## FAQ\n\n-   *XMPP server is using a self signed certificate, how can i run service?*\n    You can allow insecure TLS connections and HTTPS requests by adding `Environment=NODE_TLS_REJECT_UNAUTHORIZED=0` in /usr/lib/systemd/system/xmpp-bot.service.\n\n## Credits\n\n-   **[Nioc](https://github.com/nioc/)** - _Initial work_\n\nSee also the list of [contributors](https://github.com/nioc/xmpp-bot/contributors) to this project.\n\nThis project is powered by the following components:\n\n-   [xmpp.js](https://github.com/simple-xmpp/node-simple-xmpp) (ISC)\n-   [express](https://github.com/expressjs/express) (MIT)\n-   [body-parser](https://github.com/expressjs/body-parser) (MIT)\n-   [express-basic-auth](https://github.com/LionC/express-basic-auth) (MIT)\n-   [morgan](https://github.com/expressjs/morgan) (MIT)\n-   [jmespath.js](https://github.com/jmespath/jmespath.js) (Apache-2.0)\n-   [request](https://github.com/request/request) (Apache-2.0)\n-   [node-cleanup](https://github.com/jtlapp/node-cleanup) (MIT)\n-   [log4js-node](https://github.com/log4js-node/log4js-node) (Apache-2.0)\n\n## License\n\nThis project is licensed under the GNU Affero General Public License v3.0 - see the [LICENSE](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fxmpp-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnioc%2Fxmpp-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fxmpp-bot/lists"}