You can fetch a list of all tags for a given workspace.
1
//native
2
type Intercom = {
3
apiVersion: string
4
token: string
5
}
6
/**
7
* List all tags
8
* You can fetch a list of all tags for a given workspace.
9
10
11
*/
12
export async function main(auth: Intercom) {
13
const url = new URL(`https://api.intercom.io/tags`)
14
15
const response = await fetch(url, {
16
method: 'GET',
17
headers: {
18
'Intercom-Version': auth.apiVersion,
19
Authorization: 'Bearer ' + auth.token
20
},
21
body: undefined
22
})
23
if (!response.ok) {
24
const text = await response.text()
25
throw new Error(`${response.status} ${text}`)
26
27
return await response.json()
28
29