docs/platform/sdks/server/go.mdx
Novu's Go SDK provides simple, yet comprehensive notification management, and delivery capabilities through multiple channels that you can implement using code that integrates seamlessly with your Go application.
Explore the source code on GitHub
go get github.com/novuhq/novu-go
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": "[email protected]",
},
},
To: components.CreateToSubscriberPayloadDto(
components.SubscriberPayloadDto{
SubscriberID: "subscriber_uniuqe_identifier",
FirstName: "Albert",
LastName: "Einstein",
Email: "[email protected]",
},
),
}, nil)
if err != nil {
log.Fatal(err)
}
if res.TriggerEventResponseDto != nil {
// handle response
}
}
</Tab>
<Tab title="EU Region">
```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.WithServerURL("https://eu.api.novu.co"),
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": "[email protected]",
},
},
To: components.CreateToSubscriberPayloadDto(
components.SubscriberPayloadDto{
SubscriberID: "subscriber_uniuqe_identifier",
FirstName: "Albert",
LastName: "Einstein",
Email: "[email protected]",
},
),
}, nil)
if err != nil {
log.Fatal(err)
}
if res.TriggerEventResponseDto != nil {
// handle response
}
}