Skip to content
A Go client library for the Segment Config API
Go Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
segment
vendor
.gitignore
.travis.yml
LICENSE
Makefile
README.md
go.mod
go.sum

README.md

segment-config-go

Travis CI Go Report Card GoDoc

segment-config-go is a Go client library for accessing the Segment Config API.

This library allows you to do the following programmatically:

  • List all your Segment sources and destinations
  • Create sources
  • Create or modify destinations
  • Enable and disable destinations

Authentication

segment-config-go requires a Segment Personal Access Token for authentication. You can generate one with the appropriate access by following the steps in the Segment documentation

Usage

import "github.com/ajbosco/segment-config-go/segment"

Construct a new Segment client with your access token and Segment workspace. For example:

accessToken :=  os.Getenv("ACCESS_TOKEN")
segmentWorkspace :=  os.Getenv("SEGMENT_WORKSPACE")

client := segment.NewClient(accessToken, segmentWorkspace)

Now you can interact with the API to do things like list all sources in your workspace:

sources, err := c.ListSources()

List destinations for a given source:

destinations, err := c.ListDestinations("your-source")

Create a new source:

source, err := c.CreateSource("your-source", "catalog/sources/javascript")

Create a new destination:

source, err := c.CreateDestination("your-source", "google-analytics", "cloud", false, nil)
You can’t perform that action at this time.