|
|
|
@@ -4,70 +4,75 @@ |
|
|
|
|
|
|
|
The playbook can install and configure [matrix-appservice-webhooks](https://github.com/turt2live/matrix-appservice-webhooks) for you. This bridge provides support for Slack-compatible webhooks. |
|
|
|
|
|
|
|
Setup Instructions: |
|
|
|
See the project's [documentation](https://github.com/turt2live/matrix-appservice-webhooks/blob/master/README.md) to learn what it does and why it might be useful to you. |
|
|
|
|
|
|
|
loosely based on [this](https://github.com/turt2live/matrix-appservice-webhooks/blob/master/README.md) |
|
|
|
## Adjusting the playbook configuration |
|
|
|
|
|
|
|
1. Add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file: |
|
|
|
To enable the bridge, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file: |
|
|
|
|
|
|
|
```yaml |
|
|
|
matrix_appservice_webhooks_enabled: true |
|
|
|
matrix_appservice_webhooks_api_secret: '<your_secret>' |
|
|
|
``` |
|
|
|
```yaml |
|
|
|
matrix_appservice_webhooks_enabled: true |
|
|
|
matrix_appservice_webhooks_api_secret: '<your_secret>' |
|
|
|
|
|
|
|
2. In case you want to change the verbosity of logging via `journalctl -fu matrix-appservice-webhooks.service` you can adjust this in `inventory/host_vars/matrix.example.com/vars.yml` as well. |
|
|
|
# Uncomment to increase the verbosity of logging via `journalctl -fu matrix-appservice-webhooks.service` |
|
|
|
# matrix_appservice_webhooks_log_level: 'verbose' |
|
|
|
|
|
|
|
**Note**: default value is: `info` and availabe log levels are : `info`, `verbose` |
|
|
|
# As of Synapse 1.90.0, uncomment to enable the backwards compatibility (https://matrix-org.github.io/synapse/latest/upgrade#upgrading-to-v1900) that this bridge needs. |
|
|
|
# Note: This deprecated method is considered insecure. |
|
|
|
# |
|
|
|
# matrix_synapse_configuration_extension_yaml: | |
|
|
|
# use_appservice_legacy_authorization: true |
|
|
|
``` |
|
|
|
|
|
|
|
```yaml |
|
|
|
matrix_appservice_webhooks_log_level: '<log_level>' |
|
|
|
``` |
|
|
|
## Installing |
|
|
|
|
|
|
|
3. As of Synapse 1.90.0, you will need to add the following to `matrix_synapse_configuration_extension_yaml` to enable the [backwards compatibility](https://matrix-org.github.io/synapse/latest/upgrade#upgrading-to-v1900) that this bridge needs: |
|
|
|
After configuring the playbook, run the [installation](installing.md) command: |
|
|
|
|
|
|
|
```yaml |
|
|
|
matrix_synapse_configuration_extension_yaml: | |
|
|
|
use_appservice_legacy_authorization: true |
|
|
|
``` |
|
|
|
```sh |
|
|
|
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start |
|
|
|
``` |
|
|
|
|
|
|
|
**Note**: This deprecated method is considered insecure. |
|
|
|
## Usage |
|
|
|
|
|
|
|
4. If you've already installed Matrix services using the playbook before, you'll need to re-run it (`--tags=setup-all,start`). If not, proceed with [configuring other playbook services](configuring-playbook.md) and then with [Installing](installing.md). Get back to this guide once ready. |
|
|
|
Invite the bridge bot user to your room in either way. |
|
|
|
|
|
|
|
5. If you're using the [Dimension integration manager](configuring-playbook-dimension.md), you can configure the Webhooks bridge by opening the Dimension integration manager -> Settings -> Bridges and selecting edit action for "Webhook Bridge". Press "Add self-hosted Bridge" button and populate "Provisioning URL" & "Shared Secret" values from `/matrix/appservice-webhooks/config/config.yaml` file's homeserver URL value and provisioning secret value, respectively. |
|
|
|
- Send `/invite @_webhook:example.com` (**Note**: Make sure you have administration permissions in your room) |
|
|
|
- Add the bridge bot to a private channel (personal channels imply you being an administrator) |
|
|
|
|
|
|
|
6. Invite the bridge bot user to your room: |
|
|
|
You then need to send a message to the bridge bot in order to receive a private message including the webhook link: |
|
|
|
|
|
|
|
- either with `/invite @_webhook:example.com` (**Note**: Make sure you have administration permissions in your room) |
|
|
|
``` |
|
|
|
!webhook |
|
|
|
``` |
|
|
|
|
|
|
|
- or simply add the bridge bot to a private channel (personal channels imply you being an administrator) |
|
|
|
The JSON body for posting messages will have to look like this: |
|
|
|
|
|
|
|
7. Send a message to the bridge bot in order to receive a private message including the webhook link. |
|
|
|
```json |
|
|
|
{ |
|
|
|
"text": "Hello world!", |
|
|
|
"format": "plain", |
|
|
|
"displayName": "My Cool Webhook", |
|
|
|
"avatar_url": "http://i.imgur.com/IDOBtEJ.png" |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|
``` |
|
|
|
!webhook |
|
|
|
``` |
|
|
|
You can test this via curl like so: |
|
|
|
|
|
|
|
8. The JSON body for posting messages will have to look like this: |
|
|
|
```sh |
|
|
|
curl --header "Content-Type: application/json" \ |
|
|
|
--data '{ |
|
|
|
"text": "Hello world!", |
|
|
|
"format": "plain", |
|
|
|
"displayName": "My Cool Webhook", |
|
|
|
"avatar_url": "http://i.imgur.com/IDOBtEJ.png" |
|
|
|
}' \ |
|
|
|
<the webhook link you've gotten from the bridge bot> |
|
|
|
``` |
|
|
|
|
|
|
|
```json |
|
|
|
{ |
|
|
|
"text": "Hello world!", |
|
|
|
"format": "plain", |
|
|
|
"displayName": "My Cool Webhook", |
|
|
|
"avatar_url": "http://i.imgur.com/IDOBtEJ.png" |
|
|
|
} |
|
|
|
``` |
|
|
|
### Setting Webhooks with Dimension integration manager |
|
|
|
|
|
|
|
You can test this via curl like so: |
|
|
|
If you're using the [Dimension integration manager](configuring-playbook-dimension.md), you can configure the Webhooks bridge with it. |
|
|
|
|
|
|
|
```sh |
|
|
|
curl --header "Content-Type: application/json" \ |
|
|
|
--data '{ |
|
|
|
"text": "Hello world!", |
|
|
|
"format": "plain", |
|
|
|
"displayName": "My Cool Webhook", |
|
|
|
"avatar_url": "http://i.imgur.com/IDOBtEJ.png" |
|
|
|
}' \ |
|
|
|
<the link you've gotten in 5.> |
|
|
|
``` |
|
|
|
To configure it, open the Dimension integration manager, and go to "Settings" and "Bridges", then select edit action for "Webhook Bridge". |
|
|
|
|
|
|
|
On the UI, press "Add self-hosted Bridge" button and populate "Provisioning URL" and "Shared Secret" values from `/matrix/appservice-webhooks/config/config.yaml` file's homeserver URL value and provisioning secret value, respectively. |