notificationSenderv0.0.1
As bridge to other notification type service
When firing this event make sure you set the `Data` payload. Our schemas have standard metadata make sure you read and follow it.
Details
This event can be triggered multiple times. Everytime it triggered, notification type triggered.
We have other notification type that allows this event to send bulk notifications one by one based on each notification type.
Payload and Data Type
Data payload type:
type Notification struct { SMS *SMS `json:"sms"` Email *Email `json:"email"` PushNotification *PushNotification `json:"push_notification"` Type int `json:"type" validate:"required"` //enum notification, email, push notification Options *Options `json:"options"` }
type ( Email struct { Type string `json:"type" form:"type"` FullName string `json:"full_name" form:"full_name"` Email string `json:"email" form:"email"` Lang string `json:"lang" form:"lang"` LinkURL string `json:"link_url" form:"link_url"` VersionTemplate int `json:"template" form:"template"` Subject string `json:"subject"` Data interface{} `json:"data" form:"data"` } SMS struct { Receiver string `json:"receiver"` Content string `json:"content"` Type int `json:"type"` Options *Options `json:"options"` } PushNotification struct { ReceiverIDs []string `json:"receiver_ids"` Contents StringMap `json:"contents"` Headings StringMap `json:"headings"` Url *string `json:"url"` Options *Options `json:"options"` Segments []string `json:"segments"` } )
type ( Options struct { IsOTP bool `json:"is_otp"` } StringMap struct { En *string `json:"en"` Id *string `json:"id"` } )
Example
- Push Notification
url := "https://reku.id/blank" dataPushNotification := Notification{ PushNotification: &PushNotification{ ReceiverIDs:[ "cfd7e11b-c483-41bb-ace1-9be2922ec5b9", ], Contents: StringMap{ En:"Test Contents", Id:"Test Contents", }, Headings: StringMap{ En:"Test Headings", Id:"Test Headings", }, Url: &url, Segments:[ "Settlement", ], }, Type: 1, }
dataEmail := Notification{ Email: &Email{ Type: "sendotp", UserID: 111, FullName: "john doe", Email: "john.doe@doe.com", Lang: "id", LinkURL: "", VersionTemplate: 0, Subject: "OTP", Data: map[string]interface{}{ "otpinfo": "Lorem ipsum", "otpnumber": "XXXXXX", "otpexpired": "Lorem ipsum", "warning": "Lorem ipsum", }, }, Type: 2, }
- SMS
dataSMS := Notification{ SMS: &SMS{ Receiver: "+6281122334488", Content: "Your OTP is XXXXXX", Type: 1, }, Type: 3, Options: &Options{ IsOTP: true, }, }
Consumer / Producer Diagram
flowchart LR
l-Other_Service[Other Service]:::producer-->notificationSender[notificationSender]:::event
classDef event stroke:#00f331,stroke-width: 4px;
classDef producer stroke:#75d7b6,stroke-width: 2px;
classDef consumer stroke:#818cf8,stroke-width: 2px;
notificationSender[notificationSender]:::event-->r-Notification_Service[Notification Service]:::consumer
click l-Other_Service href "/services/Other Service" "Go to Other Service" _self
click r-Notification_Service href "/services/Notification Service" "Go to Notification Service" _self
click notificationSender href "/domains/Notification/events/notificationSender" "Go to notificationSender" _self
Last updated on 2022/12/23