0

Delete an integration

by
Published Oct 17, 2025

Delete a integration. Any views that use this integration will be deactivated. Integrations currently used in rules and/or other integrations cannot be deleted.

Script gorgias Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Gorgias = {
3
  username: string;
4
  apiKey: string;
5
  domain: string;
6
};
7
/**
8
 * Delete an integration
9
 * Delete a integration. Any views that use this integration will be deactivated. Integrations currently used in rules and/or other integrations cannot be deleted.
10

11
 */
12
export async function main(auth: Gorgias, id: string) {
13
  const url = new URL(`https://${auth.domain}.gorgias.com/api/integrations/${id}/`);
14

15
  const response = await fetch(url, {
16
    method: "DELETE",
17
    headers: {
18
      Authorization: "Basic " + btoa(`${auth.username}:${auth.apiKey}`),
19
    },
20
    body: undefined,
21
  });
22
  if (!response.ok) {
23
    const text = await response.text();
24
    throw new Error(`${response.status} ${text}`);
25
  }
26
  return await response.text();
27
}
28