//native
type Intercom = {
apiVersion: string
token: string
}
/**
* Remove tag from a ticket
* You can remove tag from a specific ticket. This will return a tag object for the tag that was removed from the ticket.
*/
export async function main(
auth: Intercom,
ticket_id: string,
id: string,
body: { admin_id: string }
) {
const url = new URL(`https://api.intercom.io/tickets/${ticket_id}/tags/${id}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
'Intercom-Version': auth.apiVersion,
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 536 days ago