Golang client for MailChimp API 3.0.
Install with go get
:
$ go get github.com/zeekay/gochimp3
package main
import (
"fmt"
"os"
"github.com/zeekay/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@zeekay.io",
Status: "subscribed",
}
if _, err := list.CreateMember(req); err != nil {
fmt.Println("Failed to subscribe '%s'", req.EmailAddress)
os.Exit(1)
}
}