All Collections
Developers
Contacts (developers)
Contacts (developers)
Santeri avatar
Written by Santeri
Updated over a week ago

Contacts can be used for storing information about your customers or employees. You can add contacts to different lists. You can send survey invitations to lists and track individual contacts answers.

Contact object

Attributes:

  • id string
    Unique identifier for the object.

  • email string
    Contact email address. Requires a valid email.

  • eid string
    External identifier, use your CRM/ERP contact identifier to sync data back to your system

  • name string
    Contact full name, first name and last name

  • phone string
    Contact phone number with area code.

  • company string
    Contact company name.

  • type string
    Type of contact. Allowed values: customer, employee

  • status string
    Deliverability status of the contact. Allowed values: unsubscribed, unapproved_country_code, missing_contact_info, error, complaint, bounce, active. If status is other than active no new messages can be sent to the contact.

  • field_YOURFIELDNAME string (optional)
    Any number of custom fields can be added. Custom fields need to be added to Trustmary before they can be used.

  • created_at ISO 8601 with timezone
    Time contact was created.

  • updated_at ISO 8601 with timezone
    Time of last action performed on the contact object.

  • deleted_at ISO 8601 with timezone or null
    If contact was deleted, time of the last deletion.

Example

{
"id": "gkggiGLXH",
"email": "[email protected]",
"name": "Contact Name",
"phone": "+358501234567",
"company": "Company Ltd",
"created_at": "2020-10-22T14:55:52.638Z",
"updated_at": "2020-10-22T14:55:52.638Z",
"deleted_at": null,
"last_action": null,
"status": "active",
"type": "customer"
}

Getting contacts

GET /contacts

Query parameters:

  • email string (optional)
    Contact email address. If an email address is given, it will return an array with one contact_object, with corresponding email.

  • offset integer (optional)
    This enpoint give a maximum of 1000 contacts per request, to request next 1000 contacts, give offset parameter with value 1000, after that 2000 etc.

Returning

{
"contacts": [contact_objects]
}

Creating a Contact

POST /contacts

Body attributes:

  • email string
    Contact email address. Requires a valid email.

  • name string (optional)
    Contact name.

  • eid string (optional)
    External identifier, use your CRM/ERP contact identifier to sync data back to your system.

  • name string (optional)
    Contact full name, first name and last name

  • phone string (optional)
    Contact phone number with area code.

  • company string (optional)
    Contact company name.

  • field_YOURFIELDNAME string (optional)
    Any number of custom fields can be added. Custom fields need to be added to Trustmary before they can be used.

  • type string (optional)
    Type of contact. Allowed values: customer, employee (will default to customer)

  • addToLists array (optional)
    Array of list ids. You can get available list IDs from the app, by opening a list and scrolling down to the bottom where an ID field is located. A list will not be updated if the contact has been added to it earlier.

Example

{
"email": "[email protected]",
"name": "Contact Name",
"phone": "+358501234567",
"company": "Company Ltd",
"type": "customer",
"addToLists": ["MDyzFBay3"]
}

Returning

Attributes:

  • contact contact_object
    Contains the created/updated contact object.

  • action string
    If the email address was unique action will be IMPORT_CREATE, otherwise corresponding contact was updated and the action will be IMPORT_UPDATE.

  • listUpdate integer
    Number of lists that the contact was added to. If the contact is already on a list, it will not be updated.

Example

{
"contact": contact_object,
"action" : "IMPORT_CREATE",
"listsUpdated": 1
}

Deleting a Contact

DELETE /contacts

{
"email": "[email protected]"
}
Did this answer your question?