Skip to content

Synchronise the contacts from the ERP

Prerequisites

We strongly recommend using webhooks for real-time contact synchronization because:

  • Changes are reflected immediately in HIPE and ERP
  • Reduces API call volume
  • Maintains better data consistency
  • Handles relationship updates automatically

Manual Synchronization Process

Only use this API approach if webhooks aren’t feasible. The workflow is:

  1. Search for existing contact
  2. Create new contact if not found
  3. Update contact information if changes detected

Search the contact

Search by email or external ID:

Terminal window
# Search by email (exact match)
curl --location 'https://{ YOUR INSTANCE }-hipe.packitoo.com/api/users/contacts?s={"email":{"$eq":"[email protected]"}}' \
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }'
Terminal window
# Search by external ID
curl --location 'https://{ YOUR INSTANCE }-hipe.packitoo.com/api/users/contacts?s={"externalId":{"$eq":"ERP-12345"}}' \
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }'

The response should be a 200 with zero or one contact with the same email or external-id. If you don’t find any contact, you can create it.

Create the contact

To create a contact, you will need to make a POST request to the /api/users/contacts endpoint.

Body parameters:

  • email: The email of the contact optional but highly recommended since it help with the email matching process.
    • If you have multiple time the same email for multiple contacts, you can solve this issue by creating a custom field to put their the “reference email” from the ERP / Previous CRM.
  • collaborationIds: The ids of the companies the contact is linked to required if needed refer to the companies synchronisation process
  • externalId: The id from your ERP
  • customFields: The custom fields to set, see Custom fields

You can found the other parameters in the API reference.

Terminal window
curl --location 'https://{ YOUR INSTANCE }-hipe.packitoo.com/api/users/contacts' \
--header 'Content-Type: application/json' \
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }' \
--data '{
"email": "[email protected]",
"collaborationIds": ["{ COMPANY ID }"]
"externalId": "ERP-64000"
}'

You should get a 201 code with the created contact in the response. You can use the id of the contact to update it now.

Update the contact information

To update the contact information, you will need to make a PATCH request to the /api/users/contacts/{ contactId } endpoint. You can refer to the API reference for the parameters.

Terminal window
curl --request PATCH --location "https://{ YOUR INSTANCE }-hipe.packitoo.com/api/users/contacts/{ CONTACT ID }" \
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }' \
--header 'Content-Type: application/json' \
--data '{
"email": "[email protected]",
"collaborationIds": ["{ COMPANY ID }"],
"customFields":{
"myCustomFieldBool":false,
"myCustomFieldString":"myCustomValue", -- This one is based on the field value for the select
"myCustomFieldMultiSelect":["myCustomValue","myCustomValue2"],
"myCustomFieldNumber":10
}
}'

Archive the contact

To archive the contact (equivalent to delete but softly), you will need to make a DELETE request to the /api/users/{ contactId }/archived endpoint API reference.

Terminal window
curl --request DELETE --location "https://{ YOUR INSTANCE }-hipe.packitoo.com/api/users/{ CONTACT ID }/archived" \
--header 'X-ACCESS-TOKEN: { YOUR ACCESS TOKEN }' \
--header 'Content-Type: application/json'

This should return a 200 code with the archived contact in the response.