Skip to content

davars/gochimp3

 
 

Repository files navigation

gochimp3

GoDoc Build Status Gitter chat

Introduction

Golang client for MailChimp API 3.0.

Install

Install with go get:

$ go get github.com/hanzoai/gochimp3

Usage

package main

import (
    "fmt"
    "os"

    "github.com/hanzoai/gochimp3"
)

const (
    apiKey = "f6f6eb412g2b9677b00550d14d86db5e-us4"
)

func main() {
    client := gochimp3.New(apiKey)

    // Fetch list
	list, err := client.GetList("28a3d7a5", nil)
	if err != nil {
		fmt.Println("Failed to get list '%s'", listId)
		os.Exit(1)
	}

    // Add subscriber
    req := &gochimp3.MemberRequest{
        EmailAddress: "spam@hanzo.ai",
	Status: "subscribed",
    }

	if _, err := list.CreateMember(req); err != nil {
		fmt.Println("Failed to subscribe '%s'", req.EmailAddress)
		os.Exit(1)
	}
}

About

🐒 Golang client for MailChimp API 3.0.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%