Connect a Go application to Novu
go get github.com/novuhq/novu-go
package main import ( "context" novugo "github.com/novuhq/novu-go" "github.com/novuhq/novu-go/models/components" "log" "os" ) func main() { ctx := context.Background() s := novugo.New( novugo.WithSecurity(os.Getenv("NOVU_SECRET_KEY")), ) res, err := s.Trigger(ctx, components.TriggerEventRequestDto{ WorkflowID: "workflow_identifier", Payload: map[string]any{ "comment_id": "string", "post": map[string]any{ "text": "string", }, }, Overrides: map[string]map[string]any{ "email": map[string]any{ "bcc": "no-reply@novu.co", }, }, To: components.CreateToSubscriberPayloadDto( components.SubscriberPayloadDto{ SubscriberID: "subscriber_uniuqe_identifier", FirstName: "Albert", LastName: "Einstein", Email: "albert@einstein.com", }, ), }, nil) if err != nil { log.Fatal(err) } if res.TriggerEventResponseDto != nil { // handle response } }
Was this page helpful?