botkube
botkube copied to clipboard
[FR] Support for Matrix notifications
Is your feature request related to a problem? Please describe. I'm always annoyed when I want to use Matrix for notifications but it's not supported.
Describe the solution you'd like I would like to see support for Matrix
Describe alternatives you've considered N/A
@samip5 sorry what do you mean with Matrix for notifications?
@samip5 sorry what do you mean with Matrix for notifications?
@bygui86 I'm referring to this: https://matrix.org/docs/guides/client-server-api
@samip5 thanks for the reference, but still I don't really understand how you would like to implement the "Matrix" into the BotKube notifications :(
@samip5 thanks for the reference, but still I don't really understand how you would like to implement the "Matrix" into the BotKube notifications :(
I want notifications though Matrix, which is basically just a POST request to a home server URL, and the reference has the format for it. Similar to how I can get Discrod notifications from Botkube.
Example way to send message in python:
async def send_matrix_notify(room, hs, content, token):
global logger
url = f"https://{hs}/_matrix/client/r0/rooms/{room}/send/m.room.message?access_token={token}"
msg = {
"body": content,
"html": content,
"msgtype": "m.text"
}
try:
async with aiohttp.ClientSession() as session:
async with session.post(url, json=msg) as resp:
response = await resp.text()
logger.info(f"Reponse from Matrix: {response}")
except Exception as e:
logger.error(f"Execption occured: {e}")
Could you try to explain what portion do you not understand?
As a more general option, perhaps the webhook could be customizable and/or templatable? That would allow it to work with a wide variety of services with minimal effort. A wiki page can hold examples for specific services such as Matrix.
As long as the whole body of the request can be templated.
matrix as supported provider will be really great