customerio
is a Go package for integration with the Customer.io
email service.
go get github.com/joeshaw/customerio
The API is built on top of the Customer.io REST API.
Full API docs are available on godoc.
c := customerio.Client{
SiteID: "my-site-id",
APIKey: "my-api-key",
HTTPClient: http.DefaultClient,
}
// Create a new customer with ID 5, email address [email protected],
// and a couple custom attributes
err := c.Identify("5", "[email protected]", map[string]interface{}{
"name": "Bob",
"plan": "premium",
})
if err != nil {
// uh oh
}
// Track an event named "purchased" on customer ID 5, with some custom
// event attributes.
err = c.Track("5", "purchased", map[string]interface{}{
"price": 23.45,
}
if err != nil {
// uh oh
}
You may pass in a nil
map to either Identify
or Track
.