Send your data
Push customer records
Assuming your data source looks like this:
id | first_name | last_name | email_address | vip | created_at | updated_at | deleted_at |
---|---|---|---|---|---|---|---|
5920059 | Jane | Doe | [email protected] | true | 2023-04-21T17:08:47Z | 2023-05-09T11:18:12Z | |
1850402 | John | Doe | [email protected] | false | 2023-04-21T17:08:47Z | 2023-05-09T11:18:12Z | 2023-05-09T11:18:12Z |
8402052 | [email protected] | 2023-04-21T17:08:47Z | 2023-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,
}
],
},
}),
});
Updated 28 days ago