Synchronise the contacts from the ERP
Prerequisites
- An access token for the HIPE instance
- The company already synchronized in HIPE (companies guide)
Recommended Approach
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:
- Search for existing contact
- Create new contact if not found
- Update contact information if changes detected
Search the contact
Search by email or external ID:
# 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 }'# Search by external IDcurl --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 processexternalId: The id from your ERPcustomFields: The custom fields to set, see Custom fields
You can found the other parameters in the API reference.
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.
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.
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.