pushbits/internal/dispatcher/notification.go
2021-01-16 16:56:49 +01:00

19 lines
426 B
Go

package dispatcher
import (
"fmt"
"log"
"github.com/pushbits/server/internal/model"
)
// SendNotification sends a notification to the specified user.
func (d *Dispatcher) SendNotification(a *model.Application, n *model.Notification) error {
log.Printf("Sending notification to room %s.\n", a.MatrixID)
text := fmt.Sprintf("%s\n\n%s", n.Title, n.Message)
_, err := d.client.SendText(a.MatrixID, text)
return err
}