0

Delete conversation

by
Published Oct 17, 2025

Delete a conversation based on the unique conversation ID. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.user.conversation.delete|org.permission.conversation.delete|

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Delete conversation
7
 * Delete a conversation based on the unique conversation ID.
8

9
Any one of the following roles is required for this endpoint:
10

11
|Legacy Role|Equivalent Permission Set Role|
12
|-----|--------|
13
|org.user.conversation.delete|org.permission.conversation.delete|
14
 */
15
export async function main(auth: Kustomer, id: string) {
16
  const url = new URL(`https://api.kustomerapp.com/v1/conversations/${id}`);
17

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