//native
type Kustomer = {
apiKey: string;
};
/**
* Update Email Hook
* Updates an email hook based on the ID.
### Debugging
Set the debug param to true to enable email hook debugging. Setting debug to true will enable monitoring of inbound hook transactions for 24 hours. See Get Email Hook Transactions for more details.
*/
export async function main(
auth: Kustomer,
id: string,
body: { debug?: false | true; description?: string; title?: string },
) {
const url = new URL(`https://api.kustomerapp.com/v1/hooks/email/${id}`);
const response = await fetch(url, {
method: "PATCH",
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