0

Get an Email Hook by ID

by
Published Oct 17, 2025

Fetches an email hook based on the ID. An email hook allows you to pass data into Kustomer by sending HTML email. Creating an email hook will return an email address. Any email received at that address will be parsed to extract json data. For added security, the email data requires inclusion of a key. The key should be included in the script tag within the html body of the email message along with the script type, i.e. `````` This endpoint will return a maximum of 10 pages with 99 entries.

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Get an Email Hook by ID
7
 * Fetches an email hook based on the ID.
8

9
An email hook allows you to pass data into Kustomer by sending HTML email. Creating an email hook will return an email address.
10

11
Any email received at that address will be parsed to extract json data. For added security, the email data requires inclusion of
12
a key.
13

14
The key should be included in the script tag within the html body of the email message along with the script type, i.e. ``````
15

16
This endpoint will return a maximum of 10 pages with 99 entries.
17
 */
18
export async function main(auth: Kustomer, id: string) {
19
  const url = new URL(`https://api.kustomerapp.com/v1/hooks/email/${id}`);
20

21
  const response = await fetch(url, {
22
    method: "GET",
23
    headers: {
24
      Authorization: "Bearer " + auth.apiKey,
25
    },
26
    body: undefined,
27
  });
28
  if (!response.ok) {
29
    const text = await response.text();
30
    throw new Error(`${response.status} ${text}`);
31
  }
32
  return await response.json();
33
}
34