Installation
You can install the package usinggo get:
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.idemailfirstNamelastNamesourcesubscribeduserGroupuserId
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 ReferenceExample
Response
CreateContact
Example
UpdateContact()
Update an existing contact.Note: To update a contact’s email address, the contact requires aAPI ReferenceuserId.
Then you can make a request with theiruserIdand an updated email address.
Parameters
| Name | Type | Required | Notes |
|---|---|---|---|
email | string | Yes | The email address of the contact to update. If no contact exists with this email, a new contact will be created using the email and properties. |
properties | map[string]interface | No | Default or custom contact properties (must exist in your Cocoonmail account). Values can be string, number, bool, null, or date. |
mailingLists | map[string]bool | No | Mailing list IDs and subscription statuses. |
Example
Response
FindContact()
Find a contact byemail or userId.
Parameters
You must provide one parameter.| Name | Type | Required | Notes |
|---|---|---|---|
email | string | No | |
userId | string | No |
Example
Response
DeleteContact()
Delete a contact, either byemail or userId.
Parameters
You must use one parameter.| Name | Type | Required | Notes |
|---|---|---|---|
email | string | No | |
userId | string | No |