botkube icon indicating copy to clipboard operation
botkube copied to clipboard

[FR] Support for Matrix notifications

Open samip5 opened this issue 2 years ago • 7 comments

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 avatar Jul 25 '21 01:07 samip5

@samip5 sorry what do you mean with Matrix for notifications?

bygui86 avatar May 16 '22 17:05 bygui86

@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 avatar May 17 '22 04:05 samip5

@samip5 thanks for the reference, but still I don't really understand how you would like to implement the "Matrix" into the BotKube notifications :(

bygui86 avatar May 17 '22 06:05 bygui86

@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?

samip5 avatar May 17 '22 07:05 samip5

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.

disconn3ct avatar May 31 '22 19:05 disconn3ct

As long as the whole body of the request can be templated.

samip5 avatar Jun 01 '22 09:06 samip5

matrix as supported provider will be really great

HaveFun83 avatar Jul 21 '23 16:07 HaveFun83