on 2023 Aug 21 8:19 PM
Can there be a single API call to Emarsys that 1) creates(if doesn't exist)/update(if exists) the user and send out an email?
Request clarification before answering.
gauravgulati
Yes, there is a single API call to Emarsys that can create (if does not exist) or update (if exists) a user and send out an email. The call is the POST /v2/contact/ endpoint. The payload for the call must include the following fields:
key_id: The identifier of the contact. This can be the email address, the mobile number, or any other unique identifier.external_id: The external identifier of the contact. This is an optional field, but it is useful if you want to keep track of the contact in your own system.email: The email address of the contact.name: The name of the contact.fields: A list of additional contact fields.email_campaign_id: The identifier of the email campaign that you want to send.If the contact does not exist in Emarsys, the call will create a new contact and send the email. If the contact does exist, the call will update the contact and send the email.
https://dev.emarsys.com/docs/emarsys-api/ca71341280fb1-create-contacts
Here is an example of the payload for the call:
JSON<code>{
"key_id": "johndoe@example.com",
"external_id": "1234567890",
"email": "johndoe@example.com",
"name": "John Doe",
"fields": [
{
"name": "City",
"value": "New York"
},
{
"name": "State",
"value": "NY"
}
],
"email_campaign_id": 1234567890
}
The key_id and email fields are required. The other fields are optional.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.