//native
type Kustomer = {
apiKey: string;
};
/**
* Create Form Hook Org Transaction
* Creates a form hook transaction for an organization.
*/
export async function main(auth: Kustomer, org: string, hash: string) {
const url = new URL(
`https://api.kustomerapp.com/v1/hooks/form/${org}/${hash}`,
);
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: "Bearer " + auth.apiKey,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago