0

Get a Message by External ID

by
Published Oct 17, 2025

Retrieves a single message using its unique external message ID. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.user.message.read|org.permission.message.read| | Key | Value | Description | |-|-|-| | externalID | string | Unique external ID of the message. |

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 a Message by External ID
7
 * Retrieves a single message using its unique external message 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.message.read|org.permission.message.read|
14

15
| Key		| Value		| Description		|
16
|-|-|-|
17
| externalID	| string	| Unique external ID of the message.	|
18
 */
19
export async function main(auth: Kustomer) {
20
  const url = new URL(
21
    `https://api.kustomerapp.com/v1/messages/externalid=:externalId`,
22
  );
23

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