2020-09-29 19:08:56 -07:00
---
eleventyNavigation:
key: MatrixIntegration
title: Integrating with Matrix
parent: Integrations
---
2025-06-14 02:38:21 -07:00
This article will guide you through integrating Codeberg with Matrix, allowing repo updates to be automatically broadcast
to your project's Matrix room.
2020-09-29 19:08:56 -07:00
2021-05-15 00:19:47 -07:00
## Create a new Matrix account
2024-06-11 00:51:22 -07:00
2025-06-14 02:38:21 -07:00
To set up the Matrix integration, it is recommended that you [create a new account ](https://app.element.io/#/register )
dedicated to broadcasting your repo updates. This will act as a bot account.
You can create an account on your preferred Matrix server.
2020-09-29 19:08:56 -07:00
## Getting an access token
2024-06-11 00:51:22 -07:00
2025-06-14 02:38:21 -07:00
You will need an access token to give Codeberg access to send updates from your dedicated Matrix account.
Here's how to do it on the Element web client.
2020-09-29 19:08:56 -07:00
2025-06-14 02:38:21 -07:00
1. Log in to the [Element web client ](https://app.element.io/ ) in a private/incognito browser window, with the Matrix
account you created earlier.
2021-05-15 00:19:47 -07:00
2. Click on your account name in the top-left corner, then click on `All Settings` in the dropdown.
2020-09-29 19:08:56 -07:00
3. Optionally, you can set a display name and a profile picture for the account here.
4. Navigate to the `Help & About` tab on the left.
2021-11-21 03:18:14 -08:00
5. Scroll to the bottom and click on the `Access Token` dropdown in the advanced section.
2020-09-29 19:08:56 -07:00
6. Copy the access token that appears to a safe place.
2025-06-14 02:38:21 -07:00
7. **Do not log out of Element.** This will invalidate your access token.
Instead, you can simply close your private/incognito browser.
2020-09-29 19:08:56 -07:00
2023-11-26 21:45:00 -08:00
{% admonition "tip" %}
Alternatively, you can get an access token directly from the Matrix API. Read more at [Matrix's documentation ](https://www.matrix.org/docs/guides/client-server-api#login ).
{% endadmonition %}
2021-05-15 00:19:47 -07:00
2020-09-29 19:08:56 -07:00
## Connecting your repo to your Matrix using webhooks
2024-06-11 00:51:22 -07:00
2021-05-15 00:19:47 -07:00
Now we will connect the Matrix bot to your Codeberg repository. You will need admin permissions for the repo.
2024-11-28 22:12:05 -08:00
< img src = "/images/integrations/matrix/webhooks.png" alt = "webhooks" >
2021-05-15 00:19:47 -07:00
2021-05-16 04:09:28 -07:00
1. In a web browser, go to your repo and click on the `Settings` button on the top right.
2021-05-15 00:19:47 -07:00
2. Navigate to the `Webhooks` settings tab.
3. Click on the `Add Webhook` button and select `Matrix` .
2023-07-21 12:01:45 -07:00
4. Here are explanations for some key fields:
2021-05-15 00:19:47 -07:00
2024-06-11 00:51:22 -07:00
- Homeserver URL: for example `https://matrix.org`
2025-06-14 02:38:21 -07:00
- Room ID: for example `!VTjWrzxSWgLJnHgDUd:matrix.org` .
You can find this on Element in the `Advanced` tab for the room settings.
- Access token: type `Bearer <your_access_token>` .
The access token is the [one you got earlier ](#getting-an-access-token ).
- Message type: `m.text` is the most basic type of plaintext message, whereas `m.notice` is intended for bots and
[behaves slightly differently ](https://spec.matrix.org/latest/client-server-api/#mnotice ).
Add your webhook, then click on the webhook URL. At the bottom now, there will be a `Test Delivery` button.
Click this, and you will receive a message on your Matrix room!