Create or update a contact
const url = 'https://api.aelyst.ai/v1/contact/create_or_update/example';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"firstName":"Muhammad ","lastName":"Mahin","phone":"+60123456789","email":"test@example.com","language":"ms","profilePic":"https://cdn.aelyst.ai/profile_avatar.png","countryCode":"MY","custom_fields":[{"name":"Company Website","value":"https://example.com"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.aelyst.ai/v1/contact/create_or_update/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "firstName": "Muhammad ", "lastName": "Mahin", "phone": "+60123456789", "email": "test@example.com", "language": "ms", "profilePic": "https://cdn.aelyst.ai/profile_avatar.png", "countryCode": "MY", "custom_fields": [ { "name": "Company Website", "value": "https://example.com" } ] }'Creates or updates a contact.
If your request does not include contact ID and the identifiers (phone/email) in the request body do not belong to a person, your request creates a contact. If a contact already exists with the identifier in the request path, your request updates that contact (first Contact that matches).
It is highly recommended to add a delay before executing a new action after creating a new contact, as processing time is required.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Identifier of the contact that can either be a phone number, email or contact ID. Examples: id:123 , email:abdc@gmail.com , phone:+60121233112
Request Body
Section titled “Request Body”object
Following the ISO 639-1 standard.
Following the ISO 3166-1 alpha-2 standard.
object
Formatting rules
- Text: “string” (use quotation marks for the string value)
- Number: Number (without any quotation marks)
- Email: “email” (format: user@domain.com)
- URL: “url” (format: www.website.com, https://www.website.com, website.com, http://website.com)
- List: “string” (the string value must match one of the list options)
- Date: “yyyy-mm-dd” (must follow this format)
- Time: “HH:MM” (must follow 24H format, 1PM => 13:00)
- Checkbox: “true/false” (must be true for checked, false for unchecked)
Examples
Responses
Section titled “Responses”object
ID of the contact on which the action was performed.
Examplegenerated
{ "contactId": 1}object
Example
{ "code": 400, "message": "Validation error."}object
Example
{ "code": 401, "message": "UN_AUTHORIZED"}object
Example
{ "code": 429, "message": "Too Many Requests"}Headers
Section titled “Headers”Example
1Number of seconds until you can retry the request
Example
10Number of request allowed for this end point
Example
5Number of request remaining for this end point
object
Example
{ "code": 449, "message": "Your request cannot be processed at the moment as it is currently in queue. Please try again in a few minutes."}object
Example
449Example
Your request cannot be processed at the moment as it is currently in queue. Please try again in a few minutes.object
Example
449Example
Your request cannot be processed at the moment as it is currently in queue. Please try again in a few minutes.object
Example
{ "code": 500, "message": "Unexpected error occurred"}