Sync Data

Create

POST method to create/update contacts/purchases

Parameters

Name Description
account_id required Your account unique identifier to access API.
origin required String field to indicate the origin of the Contact(s) and Purchase. Example: “PMS”
options Options to validate contacts email and receive webhook response information when the request has been processed
contacts Array of contact data. Maximum 1000 contacts per request.
purchase Booking and Stay information for the contacts that are in the same request.
options[email_validation[validate]] If true, validate all contact´s emails of the bulk. This service has an extra cost and will use credits from your Cendyn CRM account. If not enough credits the import will be processed without email validation. By default: false
options[email_validation[create_if_invalid]] If true, the contact will be created unless the email is invalid. By default: false
options[email_validation[create_if_no_credit]] If not enough credits the import will be processed without email validation. By default: false
options[webhook[url]] URL where the webhook will send information
options[webhook[contacts_extra_fields]] Array that contain extra fields needed to be sent by the webhook.By default it will be sent by the webhook the following fields: _id, user_id, email, phone_countrycode, phone_number
options[webhook[purchase_extra_fields]] Array that contain extra fields need to be sent by the webhook. By default it will be sent by the webhook the following fields: transaction_code, _id
contacts[name_first] Name of the contact
contacts[name_last] Last name of the contact
contacts[email] Email of the contact
contacts[user_id] Unique identifier of contact in your backend
contacts[phone_countrycode] Country code of the contact phone. Example: “+34”
contacts[phone_number] Phone number without country code of the contact
contacts[phone] Full phone number with country code of the contact
contacts[city] City of the contact
contacts[country] Country of the contact
contacts[region] Region of the contact
contacts[zip] Zip code of the contact
contacts[full_address] Address of the contact
contacts[born_date] The date of the birthday in ISO_8601 format, Example: 1990-01-01T00:00:00Z
contacts[gender] Gender of the contact (MALE or FEMALE)
contacts[language] Language of the contact in ISO-2 format, Example: ES
contacts[facebook_id] Facebook id of the contact
contacts[facebook_friends] Number of the friends in facebook of the contact
contacts[twitter_id] Twitter id of the contact
contacts[twitter_followers] Number of the followers in twitter of the contact
contacts[tags] Array containing tags for this contact
contacts[list_subscriptions[list_id]] Id of audience list
contacts[list_subscriptions[subscribed]] If true, subscribe from this list
contacts[channel_subscriptions[channel]] Name of channel. Options: [email, sms, push]
contacts[channel_subscriptions[blacklisted]] If true, blacklist this channel
contacts[gdpr_accept_terms] Boolean type: If true, the contact accepted your terms
contacts[gdpr_marketing_consent] Boolean type: If true, the contact accepted marketing consent
contacts[gdpr_date] Date for GDPR changes in ISO_8601 format, Example: 1990-01-01T00:00:00Z
contacts[gdpr_remote_ip] String type: Contact IP when accepted GDPR
contacts[[custom field]] You can create a custom field and use in every contact, only add parameter in the json with the name of custom (no label)
purchase[campaign_id] Id of the campaign
purchase[UUID] required Universally unique identifier (UUID) of the product
purchase[transaction_code] required Transaction code of the product purchase of your backend (unique)
purchase[price] required Price of the purchase transaction
purchase[currency] required Currency of the purchase transaction in ISO 4217 format. For example USD, EUR
purchase[status] Status of purchases of the product, please use only the following status: add_cart, purchase, remove_cart, product_view, product_refund, purchase_failed, canceled, no_show, no_paid, check_in, check_out, reserved, confirmed
purchase[redeem_coupon_code] Coupon code used in the purchase
purchase[name] Name of the purchase transaction
purchase[description] Description of the purchase transaction
purchase[Purchase custom field] You can create Purchase custom field with a specific type and use it within your API request: 'https://www.cendyncrm.com/settings/product_custom_fields'

Request

Route
POST 
/account/:account_id/sync_data
Headers
Accept: application/json 
Authorization: Token token={account.secret}
Content-Type: application/json
Body
{
  "origin": "PMS",
  "options": {
    "email_validation": {
      "validate": true,
      "create_if_invalid": true,
      "create_if_no_credit": true
    },
    "webhook": {
      "url": "https://xxxxxx.xxx",
      "contacts_extra_fields": [
        "name_first"
      ],
      "purchase_extra_fields": [
        "price"
      ]
    }
  },
  "contacts": [
    {
      "email": "jhon.doe@cendyn.com",
      "name_first": "Jhon",
      "name_last": "Doe",
      "user_id": "jhon.doe@cendyn.com",
      "born_date": "1990-01-01T00:00:00Z",
      "language": "EN",
      "country": "Germany",
      "city": "Berlin",
      "gender": "male"
    }
  ],
  "purchase": {
    "transaction_code": "transaction_code_xxxx",
    "currency": "USD",
    "price": 340,
    "product_uuid": "uuid_product_xxxxx",
    "status": "check_in"
  }
}

Response

Status
201
Body
{
  "_id": "xxxxxxxxxxxxxxxxxxxxxxxx",
  "number_of_contacts": 1,
  "number_of_purchase": 1,
  "validate_emails": true,
  "contacts_extra_fields": [
    "name_first"
  ],
  "purchase_extra_fields": [
    "price"
  ],
  "webhook_url": "https://xxxxxx.xxx",
  "status": "queued"
}