0

Retrieve Churn Message preferences

by
Published Oct 17, 2025

Retrieves list of Advanced Churn Message preferences.

Script zoho Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Zoho = {
3
  token: string;
4
};
5
/**
6
 * Retrieve Churn Message preferences
7
 * Retrieves list of Advanced Churn Message preferences.
8
 */
9
export async function main(
10
  auth: Zoho,
11
  X_com_zoho_subscriptions_organizationid: string,
12
) {
13
  const url = new URL(
14
    `https://www.zohoapis.com/billing/v1/settings/preferences/churnmessages`,
15
  );
16

17
  const response = await fetch(url, {
18
    method: "GET",
19
    headers: {
20
      "X-com-zoho-subscriptions-organizationid":
21
        X_com_zoho_subscriptions_organizationid,
22
      Authorization: "Zoho-oauthtoken " + auth.token,
23
    },
24
    body: undefined,
25
  });
26
  if (!response.ok) {
27
    const text = await response.text();
28
    throw new Error(`${response.status} ${text}`);
29
  }
30
  return await response.json();
31
}
32