La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
nov. 8, 202010:46 AM - modifié nov. 8, 20203:55 PM
Contributeur
How to lookup contact ID / associate based on email. Create a new one if one isn't there.
Hello, I am very new to coding and API in general.
Using Postman, I was successfully able to create a task with the API documentation and associate the task to a contact.
However, I was only able to associate this task to the contact because I knew the ContactID.
What if I don't know the ContactID? What code needs to be written to find the contact. What if it can't find the contact, can it create one if I provide other details?
{
"engagement": {
"active": true,
"ownerId": 1,
"type": "TASK",
"timestamp": 1604811446969
},
"associations": {
"contactIds": [801],
"companyIds": [ ],
"dealIds": [ ],
"ownerIds": [ ],
"ticketIds":[ ]
},
"metadata": {
"body": "This is the body of the task.",
"subject": "Your Customer Requested a Meeting from a recent Marketing Activity",
"status": "NOT_STARTED",
"forObjectType": "CONTACT"
}
}
How to lookup contact ID / associate based on email. Create a new one if one isn't there.
Your response seems simple in concept, however, I don't have the skills/knowledge to perform that task. To create a contact is a separate endpoint/path right? So I would have to use the contact API and engagements API together somehow? I was guessing that I had to put some code where the "xxx" is below to populate a contactID when given an email address.
Just insert a contact with the same email, if the contact exist you will have a 409 error code and the id will be returned inside the error message (catch it with this regex : /ID: ([0-9]+/ ), if the contact doesn't exist it will be inserted