Trigv home

Search docs

Getting started
  • Overview
  • How Trigv works
Help
  • Send test
  • API keys
  • Channels
  • Image attachments
Guides
  • All guides
  • cURL
  • Laravel
  • AI coding agents
  • Cursor
  • Claude Code
  • OpenAI Codex
  • Other agents
SDKs
  • All SDKs
  • JavaScript
  • Python
  • PHP
  • Go
  • Ruby
  • CLI
API reference
  • API overview
  • POST /api/v1/events
  • Errors & rate limits
  • API security
More
  • OpenAPI spec
Open in ChatGPT ↗ Ask questions about this page Open in Claude ↗ Ask questions about this page Open Markdown https://trigv.com/docs-md/sdks/go.md

Go SDK

Use the official Trigv Go SDK to send push notifications from APIs, workers, CLIs, Cloud Run, Lambda, and other backend services.

Install

Code
go get github.com/trigv/[email protected]

Send a notification

Code
package main

import (
	"context"
	"log"
	"os"

	"github.com/trigv/trigv-go"
)

func main() {
	client, err := trigv.NewClient(trigv.ClientConfig{
		APIKey: os.Getenv("TRIGV_API_KEY"),
	})
	if err != nil {
		log.Fatal(err)
	}

	_, err = client.SendEvent(context.Background(), trigv.SendEventRequest{
		Channel:     "general",
		Title:       "Worker finished",
		Description: "Invoice sync completed",
		Level:       trigv.LevelSuccess,
		EventType:   "worker.completed",
	})
	if err != nil {
		log.Fatal(err)
	}
}

Event fields

FieldRequiredDescription
ChannelYesChannel slug, such as general, deploys, or payments.
TitleYesPush notification title.
DescriptionNoBody text shown in the notification.
ImageURLNoHTTPS image URL for screenshots, charts, camera snapshots, or previews.
URLNoDestination URL opened from the notification.
LevelNotrigv.LevelInfo, LevelSuccess, LevelWarning, or LevelError.
DeliveryUrgencyNostandard or time_sensitive. Defaults to standard.
EventTypeNoFree-form event label such as deploy.completed or cron.failed.
IdempotencyKeyNoDeduplication key for safe retries.

Safe retries with idempotency

Code
result, err := client.SendEvent(ctx, trigv.SendEventRequest{
	Channel:        "deploys",
	Title:          "Production deploy complete",
	IdempotencyKey: "deploy-prod-42",
})
if err != nil {
	return err
}
if result.Duplicate {
	log.Println("already sent")
}

Configuration

OptionDefaultDescription
APIKeyTRIGV_API_KEYWorkspace API key.
BaseURLhttps://api.trigv.com/apiAPI base URL.
Timeout30Request timeout in seconds.
MaxRetries2Retry count for retryable failures; 0 disables retries.

Verify the API key

Code
connection, err := client.VerifyConnection(ctx)
if err != nil {
	log.Fatal(err)
}
log.Println(connection.Workspace.Name)

Error handling

Code
result, err := client.SendEvent(ctx, req)
if err != nil {
	var validationErr *trigv.ValidationError
	var notFoundErr *trigv.NotFoundError
	var rateErr *trigv.RateLimitError

	switch {
	case errors.As(err, &validationErr):
		log.Println(validationErr.Errors)
	case errors.As(err, &notFoundErr):
		log.Println("channel not found")
	case errors.As(err, &rateErr):
		log.Println("retryable:", rateErr.Retryable)
	default:
		log.Println(err)
	}
}

Good places to use it

  • Go APIs and microservices
  • Cloud Run, Lambda, Fly.io, Railway, and background workers
  • CLI tools and scheduled jobs written in Go

Additional resources

Go Go package View the official Trigv Go SDK on pkg.go.dev. Source code View the Go SDK source on GitHub.
Previous PHP Next Ruby

On this page

    Native push alerts for developers. Send alerts from webhooks, cron jobs, and scripts. We deliver alerts to your devices, but don't keep the message or notification history on our servers.

    Follow @trigvapp →

    Built by Harish Chouhan

    Product

    • Features
    • How it works
    • Pricing
    • Docs
    • Integrations
    • SDKs
    • API
    • Full LLMs text

    Company

    • About
    • Support
    • Changelog

    Legal

    • Terms & Conditions
    • Privacy Policy
    • Cookie Policy
    • API Security
    All systems ok. Get back to coding.

    © 2026 Webtions OU (dba Trigv)