Integrating with Matrix
This article will guide you through integrating Codeberg with Matrix, allowing repo updates to be automatically broadcast to your project's Matrix room.
Create a new Matrix account
To set up the Matrix integration, it is recommended that you create a new account dedicated to broadcasting your repo updates. This will act as a bot account. You can create an account on your preferred Matrix server.
Getting an access token
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.
- Log in to the Element web client in a private/incognito browser window, with the Matrix account you created earlier.
- Click on your account name in the top-left corner, then click on
All Settings
in the dropdown. - Optionally, you can set a display name and a profile picture for the account here.
- Navigate to the
Help & About
tab on the left. - Scroll to the bottom and click on the
Access Token
dropdown in the advanced section. - Copy the access token that appears to a safe place.
- Do not log out of Element. This will invalidate your access token. Instead, you can simply close your private/incognito browser.
Alternatively, you can get an access token directly from the Matrix API. Read more at Matrix's documentation.
Connecting your repo to your Matrix using webhooks
Now we will connect the Matrix bot to your Codeberg repository. You will need admin permissions for the repo.

-
In a web browser, go to your repo and click on the
Settings
button on the top right. -
Navigate to the
Webhooks
settings tab. -
Click on the
Add Webhook
button and selectMatrix
. -
Here are explanations for some key fields:
- Homeserver URL: for example
https://matrix.org
- Room ID: for example
!VTjWrzxSWgLJnHgDUd:matrix.org
. You can find this on Element in theAdvanced
tab for the room settings. - Access token: type
Bearer <your_access_token>
. The access token is the one you got earlier. - Message type:
m.text
is the most basic type of plaintext message, whereasm.notice
is intended for bots and behaves slightly differently.
- Homeserver URL: for example
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!
Hey there! 👋 Thank you for reading this article!
Is there something missing, or do you have an idea on how to improve the documentation? Do you want to write your own article?
You're invited to contribute to the Codeberg Documentation at its source code repository, for example, by adding a pull request or joining in on the discussion in the issue tracker.
For an introduction on contributing to Codeberg Documentation, please have a look at the Contributor FAQ.
© Codeberg Docs Contributors. See LICENSE