Skip to main content
The GatelyContacts class gives you full programmatic access to Gately’s CRM — create and manage contacts, organise them into lists and segments, apply tags, track email activity, and handle unsubscribes.

Installation

Setup

GatelyContacts works in both browser and Node.js environments. It automatically selects the right internal client for each platform.

Contacts

list(options?)

List contacts with optional filtering and pagination.

get(contactId)

Fetch a single contact by ID.

create(data)

Create a new contact.

update(contactId, data)

Partially update a contact. Only the fields you pass are changed.

delete(contactId)

Permanently delete a contact.

bulkImport(contacts, options?)

Import up to 1,000 contacts in a single call. Duplicate emails are skipped by default.

Contact Sub-resources

getContactLists(contactId)

Get all lists and segments a contact belongs to.

getEmailActivity(contactId)

Get the email send/open/click history for a contact.
Activity types: sent · delivered · opened · clicked · bounced · complained · unsubscribed

getCustomFields(contactId)

Retrieve the custom fields object for a contact.

updateCustomFields(contactId, fields)

Merge-update custom fields (PATCH — existing keys are preserved).

unsubscribeContact(contactId, data?)

Unsubscribe a contact and record the reason.

resubscribeContact(contactId)

Remove the unsubscribe record and re-enable email delivery.

getUnsubscribes(contactId)

Get all unsubscribe records for a contact.

Tags

listTags()

List all tags for the project.

createTag(data)

Create a new tag.

updateTag(tagId, data)

Update a tag’s name or colour.

deleteTag(tagId)

Delete a tag. It is automatically removed from all contacts.

addTagToContact(contactId, tagId)

Attach a tag to a contact.

removeTagFromContact(contactId, tagId)

Remove a tag from a contact.

Contact Lists

listContactLists()

List all contact lists for the project.

getContactList(listId)

Get a single list by ID.

createContactList(data)

Create a new list.

updateContactList(listId, data)

Update a list’s name or description.

deleteContactList(listId)

Delete a list. Contacts are not deleted.

getListMembers(listId, options?)

Get all contacts in a list.

addContactToList(listId, contactId)

Add a contact to a list.

removeContactFromList(listId, contactId)

Remove a contact from a list.

Segments

Segments are dynamic — they automatically include contacts that match a set of filter rules.

listSegments()


getSegment(segmentId)


createSegment(data)

Create a segment with filter rules.
Supported operators:

updateSegment(segmentId, data)


deleteSegment(segmentId)


TypeScript Types

All types are exported from @gately/sdk:

ContactStatus

Contact

SegmentRule


Complete Example


List Contacts API

REST endpoint reference

Create Contact API

Create endpoint reference

Tags API

Tags endpoint reference

Segments API

Segments endpoint reference