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