Skip to content

Commit

Permalink
Merge pull request #44 from Kif11/master
Browse files Browse the repository at this point in the history
Fixed missing listID variable and replaced println with printf
  • Loading branch information
zeekay committed Jun 26, 2020
2 parents bad654a + 5a51960 commit 34f0aa1
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: "[email protected]",
Status: "subscribed",
}
// Add subscriber
req := &gochimp3.MemberRequest{
EmailAddress: "[email protected]",
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)
}
}
Expand Down

0 comments on commit 34f0aa1

Please sign in to comment.