Installation

You can install the package using go get:
Minimum Go version required: 1.20+ You will need a Cocoonmail API key to use the SDK. In your Cocoonmail account, go to the API Settings page and click Generate key. Copy this key and save it in your application code (for example as an environment variable COCOONMAIL_API_KEY ).

Usage

Default contact properties

Each contact in Cocoonmail has a set of default properties. These will always be returned in API results.
  • id
  • email
  • firstName
  • lastName
  • source
  • subscribed
  • userGroup
  • userId

Custom contact properties

You can use custom contact properties in API calls. Make sure to add custom properties in your Cocoonmail account before using them with the SDK.

TestApiKey

API Reference

Example

Response

CreateContact

Example

UpdateContact()

Update an existing contact.
Note: To update a contact’s email address, the contact requires a userId.
Then you can make a request with their userId and an updated email address.
API Reference

Parameters

Example

Response

FindContact()

Find a contact by email or userId.

Parameters

You must provide one parameter.

Example

Response

DeleteContact()

Delete a contact, either by email or userId.

Parameters

You must use one parameter.

Example

Response