//native
type Kustomer = {
apiKey: string;
};
/**
* Create customer archive search
* Searches across all customer data with criteria based on a limited number of attributes on standard objects, including Message, Conversation, and Company objects, and on custom objects.
*/
export async function main(
auth: Kustomer,
body: {
queryContext?: string;
includeDeleted?: false | true;
timeZone?: string;
and?:
| {}
| {
conversation_id?: {};
conversation_created_at?: {};
conversation_updated_at?: {};
conversation_customer_id?: {};
conversation_any_text?: {};
conversation_deleted?: {};
customer_id?: {};
customer_companyId?: {};
customer_created_at?: {};
customer_updated_at?: {};
customer_deleted?: {};
customer_any_text_new?: {};
message_id?: {};
message_created_at?: {};
message_updated_at?: {};
message_conversation_id?: {};
message_any_text?: {};
kobject_id?: {};
kobject_created_at?: {};
kobject_updated_at?: {};
kobject_customer_id?: {};
kobject_company_id?: {};
kobject_any_text?: {};
"^kobject_.*_id$"?: {};
"^kobject_.*_created_at$"?: {};
"^kobject_.*_updated_at$"?: {};
"^kobject_.*_customer_id$"?: {};
"^kobject_.*_company_id$"?: {};
"^kobject_.*_any_text$"?: {};
company_created_at?: {};
company_updated_at?: {};
}[];
or?:
| {}
| {
conversation_id?: {};
conversation_created_at?: {};
conversation_updated_at?: {};
conversation_customer_id?: {};
conversation_any_text?: {};
conversation_deleted?: {};
customer_id?: {};
customer_companyId?: {};
customer_created_at?: {};
customer_updated_at?: {};
customer_deleted?: {};
customer_any_text_new?: {};
message_id?: {};
message_created_at?: {};
message_updated_at?: {};
message_conversation_id?: {};
message_any_text?: {};
kobject_id?: {};
kobject_created_at?: {};
kobject_updated_at?: {};
kobject_customer_id?: {};
kobject_company_id?: {};
kobject_any_text?: {};
"^kobject_.*_id$"?: {};
"^kobject_.*_created_at$"?: {};
"^kobject_.*_updated_at$"?: {};
"^kobject_.*_customer_id$"?: {};
"^kobject_.*_company_id$"?: {};
"^kobject_.*_any_text$"?: {};
company_created_at?: {};
company_updated_at?: {};
}[];
not?:
| {}
| {
conversation_id?: {};
conversation_created_at?: {};
conversation_updated_at?: {};
conversation_customer_id?: {};
conversation_any_text?: {};
conversation_deleted?: {};
customer_id?: {};
customer_companyId?: {};
customer_created_at?: {};
customer_updated_at?: {};
customer_deleted?: {};
customer_any_text_new?: {};
message_id?: {};
message_created_at?: {};
message_updated_at?: {};
message_conversation_id?: {};
message_any_text?: {};
kobject_id?: {};
kobject_created_at?: {};
kobject_updated_at?: {};
kobject_customer_id?: {};
kobject_company_id?: {};
kobject_any_text?: {};
"^kobject_.*_id$"?: {};
"^kobject_.*_created_at$"?: {};
"^kobject_.*_updated_at$"?: {};
"^kobject_.*_customer_id$"?: {};
"^kobject_.*_company_id$"?: {};
"^kobject_.*_any_text$"?: {};
company_created_at?: {};
company_updated_at?: {};
}[];
sort?: {} | {}[];
},
) {
const url = new URL(
`https://api.kustomerapp.com/v1/customers/archive/search`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago