Documentation ¶
Overview ¶
Package matrix provides message notification integration for Matrix.
Usage:
package main import ( "log" "github.com/casdoor/notify" "github.com/casdoor/notify/service/matrix" ) func main() { matrixSvc, err := matrix.New("fake-user-id", "fake-room-id", "fake-home-server", "fake-access-token") if err != nil { log.Fatalf("matrix.New() failed: %s", err.Error()) } notifier := notify.New() notifier.UseServices(matrixSvc) err = notifier.Send(context.Background(), "subject", "message") if err != nil { log.Fatalf("notifier.Send() failed: %s", err.Error()) } log.Println("notification sent") }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix struct that holds necessary data to communicate with the Matrix API
func New ¶
New returns a new instance of a Matrix notification service. For more information about the Matrix api specs:
func (*Matrix) Send ¶
Send takes a message body and sends them to the previously set channel. you will need an account, access token and roomID see https://matrix.org
func (*Matrix) SetHttpClient ¶ added in v0.43.0
type Message ¶
type Message struct { Body string `json:"body"` Format string `json:"format,omitempty"` FormattedBody string `json:"formatted_body,omitempty"` Msgtype event.MessageType `json:"msgtype"` }
Message structure that reassembles the SendMessageEvent
type ServiceOptions ¶
type ServiceOptions struct {
// contains filtered or unexported fields
}
ServiceOptions allow you to configure the Matrix client options.
Click to show internal directories.
Click to hide internal directories.