//native
type Intercom = {
apiVersion: string
token: string
}
/**
* Delete a contact
* You can delete a single contact.
*/
export async function main(auth: Intercom, id: string) {
const url = new URL(`https://api.intercom.io/contacts/${id}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
'Intercom-Version': auth.apiVersion,
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 537 days ago