notiflowsDocs
SDKsServer-side

Go

Notiflows Go SDK for server-side integration

The Go SDK is coming soon. In the meantime, you can use the REST API directly.

Preview

The Go SDK will provide a simple interface for triggering notiflows and managing users:

package main

import "github.com/notiflows/notiflows-go"

func main() {
    client := notiflows.NewClient("your-secret-key")

    // Trigger a notiflow
    client.Notify(&notiflows.NotifyParams{
        Notiflow: "welcome-email",
        Recipients: []notiflows.Recipient{
            {ExternalID: "user_123"},
        },
        Data: map[string]any{
            "name": "Jane",
        },
    })

    // Manage users
    client.Users.Upsert("user_123", &notiflows.UserParams{
        Email:     "jane@example.com",
        FirstName: "Jane",
    })

    // Subscribe to topics
    client.Users.Subscribe("user_123", "product-updates")
}

Installation (Coming Soon)

go get github.com/notiflows/notiflows-go

Using the REST API

Until the SDK is available, you can interact with the API directly:

package main

import (
    "bytes"
    "encoding/json"
    "net/http"
)

func main() {
    payload := map[string]any{
        "recipients": []map[string]string{
            {"external_id": "user_123"},
        },
        "data": map[string]string{
            "name": "Jane",
        },
    }

    body, _ := json.Marshal(payload)

    req, _ := http.NewRequest(
        "POST",
        "https://api.notiflows.com/admin/v1/notiflows/welcome-email/run",
        bytes.NewBuffer(body),
    )
    req.Header.Set("Authorization", "Bearer your-secret-key")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, _ := client.Do(req)
    defer resp.Body.Close()
}

See the Admin API Reference for complete documentation.

On this page