# Go SDK for Novu (/platform/sdks/server/go)

Connect a Go application to Novu

import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

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](https://github.com/novuhq/novu-go)

## Installation

```go
go get github.com/novuhq/novu-go
```

## Usage

<Tabs items={['US Region', 'EU Region']}>
  <Tab value="US 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.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
        }

    }

    ```
  </Tab>

  <Tab value="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": "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
    	}
    }
    ```
  </Tab>
</Tabs>
