notification

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

README

notification

notification is a helper send message notification use port adapter service.

available service:

  • mattermost service
Usage example
  1. Notification use mattermost service
c, err := notification.NewClient(mattermost.MattermostAdapter{
    Service: &mattermost.MattermostNotif{
            Cfg: &mattermost.Config{
            SiteUrl:     "http://localhost:8065",
            AccessToken: "odh5mxnw1igc7k4u77k6qs5x7w",
            TeamName: "clodeo",
        }
    }
})

if err != nil {
    log.Println("error initialize notification client, err : ", err)
    return
}

err = c.SendGroupMessage("clodeo-integrasi", notification.Message{
    Title: "Tokopedia User Join",
    Body: "**Mamas Rafi Buzer Joined**",
    })

if err != nil {
    log.Println("error post message, err : ", err)
    return
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct{}

func NewClient

func NewClient(o Notification) (*Client, error)

func (*Client) SendGroupMessage

func (c *Client) SendGroupMessage(groupName string, msg Message) error

type Message

type Message struct {
	Title string
	Body  string
}

type Notification

type Notification interface {
	Init() error
	SendGroupMessage(groupName string, msg Message) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL