Help us shape the future of Go! Take the 2026 Go Developer Survey

drip

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2020 License: MIT Imports: 9 Imported by: 0

README

go-drip

Drip API wrapper for golang

Features

  • Create a subscriber by email address
  • Track an event
  • Custom fields for subscribers and events
  • Tagging/untagging subscribers
  • Custom field key normalization

Not yet implemented:

  • Other API endpoints

Examples

dripClient = drip.NewClient("DRIP_API_TOKEN", "DRIP_ACCOUNT_ID")
_ = dripClient.CreateSubscriber("an@email-adress.com", map[string]interface{}{ "first_name": "Chris" })
_ = dripClient.RecordEvent("an@email-address.com", "Registered")
_ = dripClient.TagSubscriber("an@email-address.com", "Beta")

Key normailzation

go-drip will normalize custom fields keys by removing $ characters, replacing spaces with underscores, and lower casing the entire key. For example:

"First Name" => "first_name"
"$email" => "email"

Drip will not add any custom fields even if only one key is malformed. This feature tries to guard you against that and helps avoid re-implementing the same transformations. I'm happy to accept or add additional transformations, if you'd benefit from them.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Drip API client wrapper

func NewClient

func NewClient(apiKey, appID string) *Client

NewClient returns a client instance ready to act with Drip for the given app and API key

func (Client) CreateSubscriber

func (c Client) CreateSubscriber(email string, customFields map[string]interface{}) error

CreateSubscriber creates a new or updates an existing subscriber by email

func (Client) RecordEvent

func (c Client) RecordEvent(email, eventName string) error

RecordEvent sends a custom event to Drip

func (Client) TagSubscriber

func (c Client) TagSubscriber(email, tag string) error

TagSubscriber adds a tag to a subscriber

func (Client) UntagSubscriber added in v0.2.0

func (c Client) UntagSubscriber(email, tagName string) error

UntagSubscriber removes a tag from the subscriber email address

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL