Send your data

Push customer records

Assuming your data source looks like this:

idfirst_namelast_nameemail_addressvipcreated_atupdated_atdeleted_at
5920059JaneDoe[email protected]true2023-04-21T17:08:47Z2023-05-09T11:18:12Z
1850402JohnDoe[email protected]false2023-04-21T17:08:47Z2023-05-09T11:18:12Z2023-05-09T11:18:12Z
8402052[email protected]2023-04-21T17:08:47Z2023-05-09T11:18:12Z

You can push these two 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: "5920059",
          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: "1850402",
          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: "8402052",
          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,
        }
      ],
    },
  }),
});