Send customer data

Push customer records

Example customer records

Let's assume you have customers that look something like this:

idfirst_namelast_nameemail_addressvipcreated_atupdated_atdeleted_at
cust_1JaneDoe[email protected]true2023-04-21T17:08:47Z2023-05-09T11:18:12Z
cust_2JohnDoe[email protected]false2023-04-21T17:08:47Z2023-05-09T11:18:12Z2023-05-09T11:18:12Z
cust_3[email protected]2023-04-21T17:08:47Z2023-05-09T11:18:12Z

Example mutation

You can push these records using any HTTP compatible library:

fetch("https://api.endearhq.com", {
  method: "POST",
  headers: {
    "content-type": "application/json",
    "x-endear-api-key": "{{API_KEY}}",
  },
  body: JSON.stringify({
    query: `
      mutation BulkUpsertExternalCustomers($customers: [ExternalCustomerInput!]!) {
        bulkUpsertExternalCustomers(customers: $customers) {
            status
        }
      }
    `,
    variables: {
      customers: [
      	{
          id: "cust_1",
          first_name: "Jane",
          last_name: "Doe",
          email_address: "[email protected]",
          tags: ["vip"],
          created_at: "2023-04-21T17:08:47Z",
          updated_at: "2023-05-09T11:18:12Z",
          deleted_at: null,
        },
        {
          id: "cust_2",
          first_name: "John",
          last_name: "Doe",
          email_address: "[email protected]",
          tags: [],
          created_at: "2023-04-21T17:08:47Z",
          updated_at: "2023-05-09T11:18:12Z",
          deleted_at: "2023-05-09T11:18:12Z",
        },
        {
          id: "cust_3",
          first_name: null,
          last_name: null,
          email_address: "[email protected]",
          tags: [],
          created_at: "2023-04-21T17:08:47Z",
          updated_at: "2023-05-09T11:18:12Z",
          deleted_at: null,
        }
      ],
    },
  }),
});