Sendy API module written in Go
Using explicit structs instead of generic Object struct

heads

tip
browse log

clone

read-only
https://hg.code.netlandish.com/~netlandish/sendygo
read/write
ssh://hg@hg.code.netlandish.com/~netlandish/sendygo

#sendygo nlshield

A simple Go client to interface with the Sendy API (https://sendy.co/api)

Project Links: Issues - Mailing List - Contributing

Version: 0.1.0

Sendy API Version: 6.0.3

Author Netlandish (http://www.netlandish.com)

#Dependencies

  • It was written for Go 1.18+
  • No external dependencies are required

#Installation

go get hg.code.netlandish.com/~netlandish/sendygo

#Use

All the variables and response values are described in the Sendy API docs

Usage is simple:

import "hg.code.netlandish.com/~netlandish/sendygo" 

baseURL := "https://your-sendy-install.com/sendy/"
apiKey := "YOUR_API_KEY"
debug := true

client := sendy.NewClient(baseURL, apiKey, debug)

Subscribe :

    err := client.Subscribe(sendy.SusbcribeParams{
        List:     "list id here",
        Email:    "email@address.com",
        Name:     "Name",
        Country:  "NI",
        Referrer: "https://webpage.com",
        GDPR:     true,
    })

Fields

  • Email: user's email
  • List: the list id you want to subscribe a user to
  • Name: user's name (optional)
  • Country: user's 2 letter country code (optional)
  • IPAddress: user's IP address (optional)
  • Referrer: the URL where the user signed up from (optional)
  • GDPR: if you're signing up EU users in a GDPR compliant manner, set this to "true" (optional)
  • Silent: set to true if your list is 'Double opt-in' but you want to bypass that and signup the user to the list as 'Single Opt-in instead' (optional)
  • HP: include this 'honeypot' field to prevent spambots from signing up via this API call. (optional)

Unsubscribe :

    err := client.Unsubscribe(sendy.UnsusbcribeParams{
        List:     "list id here",
        Email:    "email@address.com",
    })

Delete :

    err := client.DeleteSubscriber(sendy.ActionParams{
        List:     "list id here",
        Email:    "email@address.com",
    })

Subscription Status :

    status, err = client.SubscriptionStatus(&sendy.ActionParams{
        List:     "list id here",
        Email:    "email@address.com",
    })

Subscriber Count :

	count, err := client.SubscriberCount(sendy.ActionParams{
        List:     "list id here",
	})

Create Campaign :

action, err := client.CreateCampaign(sendy.CreateCampaignParams{
	FromName:           "Your Name",
	FromEmail:          "Your Sender Email",
	ReplyTo:            "Your Reply-to Email",
	Title:              "Email Title",
	Subject:            "Email Subject",
	PlainText:          "Plain text for the email",
	HTMLText:           "<p>Html format for the email</p>",
	ListIDS:            "listIDOne,listIDTwo,listIDThree",
	BrandID:            "Your Brand ID",
	QueryString:        "Your Query String",
	SendCampaign:       1,
	SegmentIDS:         "SegmentOne, SegmentTwo",
	ExcludeListIDS:     "listIDOne,listIDTwo,listIDThree",
	ExcludeSegmentsIDS: "SegmentOne, SegmentTwo",
	TrackOpens:         1,
	TrackClicks:        1,
	ScheduleDateTime:   "June 15, 2023 6:05pm",
	ScheduleTimeZone:   "America/New_York",
})

#Contributing

We accept patches submitted via hg email which is the patchbomb extension included with Mercurial.

Please see our contributing document for more information.

The mailing list where you submit your patches is ~netlandish/public-inbox@lists.code.netlandish.com. You can also view the archives on the web here:

https://lists.code.netlandish.com/~netlandish/public-inbox

To quickly setup your clone of sendygo to submit to the mailing list just edit your .hg/hgrc file and add the following:

[email]
to = ~netlandish/public-inbox@lists.code.netlandish.com

[patchbomb]
flagtemplate = {separate(' ', 'sendygo', flags)}

[diff]
git = 1

We have more information on the topic here:

All documentation, libraries, and sample code are Copyright 2022 Netlandish Inc. <hello@netlandish.com>. The library and sample code are made available to you under the terms of the BSD license which is contained in the included file, LICENSE.

#Commercial Support

This software, and lots of other software like it, has been built in support of many of Netlandish's own projects, and the projects of our clients. We would love to help you on your next project so get in touch by dropping us a note at hello@netlandish.com.