Batch

This endpoint allows you to send a batch of actions for processing contacts.

Batch

POST https://api.carts.guru/contacts/v1/batch

Headers

Request Body

{    
  data: {
    batchId: "1234asdf1234"
  }
}

Authorized Actions

{
    "actions": [
        {
            "create": {
                // At least one of the three identifiers is REQUIRED 
                // email, phoneNumber, accountId
                email: String        // The contact's email
                phoneNumber: String  // The contact's phone number
                accountId: String    //The contact's accountId on your platform
                 
                firstname: Optional (String)     // The contact's first name
                lastname: Optional (String)      // The contact's last name
                optoutEmail: Optional (Boolean)  // true if they are opted out.
                optoutSms: Optional (Boolean)    // true if they are opted out.
                addresses: Optional (Array of Objects) - Addresses of the contact.
                ex: 
                    [
                        {
                            title
                            line1
                            line2
                            city
                            zipcode
                            country - Required if passing in addresses.
                        }
                    ] 
            }
        }
    ]
}

Code samples

import fetch from 'node-fetch'

const res = await fetch(`https://api.carts.guru/contacts/v1/batch`, {
  method: 'POST',
  headers: {
    'content-type': 'application/json',
    authorization: 'Basic c8l0ZS0xOjE1ODQwMzc4MTI6Q2wwWHNoVHLaUFdHaDR0ZkZpVkdlbFlaMUxpeDdtdVR6SnBDUndHZlgydz0='
  },
  body: JSON.stringify({
    actions: [
      { delete: { email: 'hi@carts.guru' } },
      { delete: { phoneNumber: '41343432413' } },
      { delete: { accountId: 'accountId-1' } },
      {
        create: {
          phoneNumber: '14158888888',
          email: 'bobsburgers@carts.guru',
          firstname: 'bob',
          lastname: 'burger'
        }
      },
      {
        update: {
          accountId: '7777777',
          email: 'bern777@carts.guru',
          phoneNumber: '14157777777',
          firstname: 'Bern'
        }
      }
    ]
  })
})

Last updated