Comment on which library for a selfhosted simple matrix bot?

yaroto98@lemmy.world ⁨1⁩ ⁨week⁩ ago

I’m not sure about bots, but if you don’t shy away from python, I just use the requests library:

homeserver_url = “XXX”

access_token = “XXX”

room_id = “!XXX”

url = f{homeserver_url}/_matrix/client/r0/rooms/{room_id}/send/m.room.message"

headers = {“Authorization”: f"Bearer {access_token}",“Content-Type”: “application/json”,}

data = `“msgtype”: “m.text”,“body”: “Question of the day!”,}

response = requests.post(url, headers=headers, data=json.dumps(data))

source
Sort:hotnewtop