//native
type Intercom = {
apiVersion: string
token: string
}
/**
* Remove subscription from a contact
* You can remove a specific subscription from a contact. This will return a subscription type model for the subscription type that was removed from the contact.
*/
export async function main(auth: Intercom, contact_id: string, id: string) {
const url = new URL(`https://api.intercom.io/contacts/${contact_id}/subscriptions/${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 536 days ago