//native
type Kustomer = {
apiKey: string;
};
/**
* Update Form Hook
* Updates a form hook based on the ID.
### Debugging
Set the debug param to true to enable form hook debugging. Setting debug to true will enable monitoring of inbound hook transactions for 24 hours.
See Get Form 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/form/${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