Send customer data
Push customer records
Example customer records
Let's assume you have customers that look something like this:
id | first_name | last_name | email_address | vip | created_at | updated_at | deleted_at |
---|---|---|---|---|---|---|---|
cust_1 | Jane | Doe | [email protected] | true | 2023-04-21T17:08:47Z | 2023-05-09T11:18:12Z | |
cust_2 | John | Doe | [email protected] | false | 2023-04-21T17:08:47Z | 2023-05-09T11:18:12Z | 2023-05-09T11:18:12Z |
cust_3 | [email protected] | 2023-04-21T17:08:47Z | 2023-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,
}
],
},
}),
});
Updated 6 months ago
What’s Next