I’m recording users in a local database and then, if they checked the newsletter flag, I am using the API v3 to add them to a specific list with a special tag.
To do this I use the following APIs:
- contact/sync - to create the contact e/o to get is contact ID
- ‘contacts/’. $contactId - to check if the user is already subscribed to the list
If I can proceed then:
- contactLists - to add the user to the list
- contactTags - to add the tags that start the automation
Am I doing it correctly?
Is that OK to run 4 API call for transactions?
Is there a way with contact/sync to get to know if the user is already inside the list
so at least I can save 1 API call (omitting contacts/$contactId) ?
Thank you
What you described will work. If you want to reduce the number of API calls, you may want to look at using the contact_sync
v1 API method. (v1 API is still supported) This endpoint allows you to syncing Contact data, assigning the Contact to a List, and adding tags to the Contact all with a single API call.
If you’d like to do bulk contact creation, the subscribe array is available on contact creation, if you use the v1 api endpoint API Examples Using contact_add the subscription array (of integers) is called "p"
The subscribe
array is not a field available on the individual create contact v3 POST endpoint.
This is an “upcert” function, a contact will either be created or updated, unless it already exists, in which case it will be skipped: Here are the requirements: Bulk import contacts
1 Like