Creating a bot account - Internal Room ID and Access Token information
Creating a bot account - Internal Room ID and Access Token information
I don't know who might need this in the future, but I'm setting up a bot account for my BT Free space. I've never done this before and I wanted to document it a bit for myself or anyone else that is interested in the future.
Make sure you have your home server information. This is just the URL, in my case it's https://matrix.org/.
Then I needed to get the room id that I want the bot to be a part of. You can get this via the room info - Settings - Advanced - Internal Room ID.
Then I need the Access Token for the user I want to use with my bot. In this case it's my new user I just created called btfree_bot. I did this through the Element Web UI (https://app.element.io/). Click the user in the upper left - All Settings - Help & About - Advanced - Access Token.
I attempted to get the access token via curl, but it kept failing. If anyone wants to let me know what I did wrong with the curl, at least it might help someone in the future. :-)
curl -XPOST -d '{"type": "m.login.password", "identifier": {"user": "btfree_bot", "type": "m.id.user"}, "password": "MYPASSWORD"}' "https://matrix.org/_matrix/client/r0/login"
EDIT: So the access token from the Element Web didn't work for us. Not sure why. But my friend figured out that we were missing the -H header to indicate json. Which makes sense. Here's the command we used to get the access token:
$ curl -XPOST -H "Content-Type: application/json" -d '{"type": "m.login.password", "identifier": {"user": "btfree_bot", "type": "m.id.user"}, "password": "-PASSWORD-"}' "https://matrix.org/_matrix/client/r0/login"
The instructions we had that missed the header -H part were from inside of Uptime Kuma. We're going to do a PR to have them update their docs.