From 5a5196083e3da6c6d8737f48e0177e60badbd898 Mon Sep 17 00:00:00 2001 From: Kirill Kovalevskiy Date: Thu, 25 Jun 2020 18:43:47 -0700 Subject: [PATCH] Fixed missing listID variable and replaced println with printf --- README.md | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 44be80f..3bcf7bc 100644 --- a/README.md +++ b/README.md @@ -16,34 +16,38 @@ $ go get github.com/hanzoai/gochimp3 package main import ( - "fmt" - "os" + "fmt" + "os" - "github.com/hanzoai/gochimp3" + "github.com/hanzoai/gochimp3" ) const ( - apiKey = "f6f6eb412g2b9677b00550d14d86db5e-us4" + apiKey = "YOUR_API_KEY_HERE" ) func main() { - client := gochimp3.New(apiKey) + client := gochimp3.New(apiKey) - // Fetch list - list, err := client.GetList("28a3d7a5", nil) + // Audience ID + // https://mailchimp.com/help/find-audience-id/ + listID := "7f12f9b3fz" + + // Fetch list + list, err := client.GetList(listID, nil) if err != nil { - fmt.Println("Failed to get list '%s'", listId) + fmt.Printf("Failed to get list %s", listID) os.Exit(1) } - // Add subscriber - req := &gochimp3.MemberRequest{ - EmailAddress: "spam@hanzo.ai", - Status: "subscribed", - } + // Add subscriber + req := &gochimp3.MemberRequest{ + EmailAddress: "test@mail.com", + Status: "subscribed", + } if _, err := list.CreateMember(req); err != nil { - fmt.Println("Failed to subscribe '%s'", req.EmailAddress) + fmt.Printf("Failed to subscribe %s", req.EmailAddress) os.Exit(1) } }