nim65s / matrix-webhook

Post a message to a matrix room with a simple HTTP POST
https://code.ffdn.org/tetaneutral.net/matrix-webhook
Other
106 stars 32 forks source link

Unable to get it working #168

Open jhjacobs81 opened 1 month ago

jhjacobs81 commented 1 month ago

Hello,

I have created a docker-compose.yml file like so:

services:
  matrix-whook:
    image: nim65s/matrix-webhook:latest
    container_name: matrix-whook
    environment:
      - MATRIX_URL="HOMESERVER"
      - MATRIX_ID="bot:HOMESERVER"
      - MATRIX_PW="PASSWORD"
      - API_KEY="SECRET"
    ports:
      - 4785:4785
    restart: always
    networks:
      - matrix-lan

networks:
    default:
        driver: bridge
    matrix-lan:
        external: true

This seems to spin up normally, but after that nothing happens. I can see its running when i do docker ps. But i cant invite the bot to any rooms, and when i try to use the curl command as per documentation, it just hangs.. nothing happens?

I am unsure what i am doing wrong here? matrix-lan is the network the matrix server is also on, MATRIX_URL is the fqdn of the server which works normally. the account for the bot is created as well.

nim65s commented 1 month ago

I guess we need to increase verbosity. But that is not trivial enough, I'll open a PR to deal with this.

jhjacobs81 commented 1 month ago

when i run it with docker compose it hangs at "attaching to matrix-whook" and then nothing. (so i assume its working)

I thought this bot would respond to invites, join the room, and then i could have outside services send messages to that room through the webhook, but maybe i am mistaken?

nim65s commented 1 month ago

You can impersonate the bot in a real matrix client, and check if the bot can join those room manually

nim65s commented 1 month ago

now #169 is merged, if you pull the new docker image, you can add VERBOSITY=3 or 4, and you should get more info

jhjacobs81 commented 1 month ago

thanks, let me try that :)

In element, i can join the invited rooms normally.

jhjacobs81 commented 1 month ago

that results in:

Attaching to matrix-whook
matrix-whook  | Traceback (most recent call last):
matrix-whook  |   File "<frozen runpy>", line 198, in _run_module_as_main
matrix-whook  |   File "<frozen runpy>", line 88, in _run_code
matrix-whook  |   File "/matrix_webhook/__main__.py", line 16, in <module>
matrix-whook  |     main()
matrix-whook  |   File "/matrix_webhook/__main__.py", line 12, in main
matrix-whook  |     app.run()
matrix-whook  |   File "/matrix_webhook/app.py", line 66, in run
matrix-whook  |     loop.run_until_complete(main(event))
matrix-whook  |   File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
matrix-whook  |     return future.result()
matrix-whook  |            ^^^^^^^^^^^^^^^
matrix-whook  |   File "/matrix_webhook/app.py", line 23, in main
matrix-whook  |     await utils.CLIENT.login(conf.MATRIX_PW)
matrix-whook  |   File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 1097, in login
matrix-whook  |     return await self._send(LoginResponse, method, path, data)
matrix-whook  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
matrix-whook  |   File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 777, in _send
matrix-whook  |     transport_resp = await self.send(
matrix-whook  |                      ^^^^^^^^^^^^^^^^
matrix-whook  |   File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 291, in wrapper
matrix-whook  |     return await func(self, *args, **kwargs)
matrix-whook  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
matrix-whook  |   File "/usr/local/lib/python3.11/site-packages/nio/client/async_client.py", line 855, in send
matrix-whook  |     return await self.client_session.request(
matrix-whook  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
matrix-whook  |   File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 545, in _request
matrix-whook  |     req = self._request_class(
matrix-whook  |           ^^^^^^^^^^^^^^^^^^^^
matrix-whook  |   File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 326, in __init__
matrix-whook  |     self.update_host(url)
matrix-whook  |   File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 400, in update_host
matrix-whook  |     raise InvalidURL(url)
matrix-whook  | aiohttp.client_exceptions.InvalidURL: %22https://<URL>%22/_matrix/client/r0/login
matrix-whook exited with code 0
nim65s commented 1 month ago

Better. Those %22 here seems to indicate you should remove surrounding " characters from your URL

jhjacobs81 commented 1 month ago

i did that for all the variables, now i'm back to "it hangs at attaching to matrix-whook" It doesnt come online, but its not outputting anything either.

jhjacobs81 commented 1 month ago

should i download the whole directory and build it using the Dockerfile? or is the image working itself?