//native
type Intercom = {
apiVersion: string
token: string
}
/**
* Update a company
* You can update a single company using the Intercom provisioned `id`.
{% admonition type="attention" name="Using `company_id`" %}
When updating a company it is not possible to update `company_id`. This can only be set once upon creation of the company.
{% /admonition %}
*/
export async function main(auth: Intercom, id: string) {
const url = new URL(`https://api.intercom.io/companies/${id}`)
const response = await fetch(url, {
method: 'PUT',
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