Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix notification #124

Closed
poperigby opened this issue Jul 13, 2020 · 6 comments · Fixed by #136
Closed

Matrix notification #124

poperigby opened this issue Jul 13, 2020 · 6 comments · Fixed by #136

Comments

@poperigby
Copy link

I'm trying to get Diun to send a message to a Matrix room using webhooks. This is what Matrix is expecting:

{
  "text": Message
  "format": Plain or HTML
  "displayName": The webhook's Matrix display name
}

Is it possible for me to make it so Diun's JSON will be formatted so it fits into the text section?

@crazy-max
Copy link
Owner

@poperigby I'll need more information so we can integrate the notifications for Matrix:

  • Link to API documentation
  • Auth method and endpoint to call

@crazy-max crazy-max changed the title [Question] Formatting JSON to work with Matrix? Matrix notification Jul 16, 2020
@poperigby
Copy link
Author

poperigby commented Jul 16, 2020

Here's the client server API for Matrix: https://matrix.org/docs/spec/client_server/latest

I think you might need to use a bot to send the notifications. Here's a bot SDK written in Go, because you seem to be comfortable with that language: https://github.com/tulir/mautrix-go

Alternatively you could try and make Diun work with this existing webhook bot: https://github.com/turt2live/matrix-appservice-webhooks.

Do either of these seem feasible to you? I could try and dig something else if they don't work.

@mwalbeck
Copy link

There is a simple endpoint for sending messages to a room, which is definitely the easiest way to do this. The relevant areas in the documentation, which @poperigby linked above, are:

  • 5.1 - Using access token for auth, can be via request header or query string
  • 9.6.2 - The endpoint to use
  • 13.2.1.1 - The event type to use with the endpoint, m.room.message
  • 13.2.1.7 - The different message types available, the relevant one being m.notice, which is intended for automated messages.

crazy-max added a commit that referenced this issue Jul 28, 2020
crazy-max added a commit that referenced this issue Jul 29, 2020
* Add Matrix notification (#124)
* Fix docs

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max
Copy link
Owner

@poperigby
Copy link
Author

That was fast. Thanks!

@mwalbeck
Copy link

Tried with v4.3.1 and it works great. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants