//native
type Intercom = {
apiVersion: string
token: string
}
/**
* Create a collection
* You can create a new collection by making a POST request to `https://api.intercom.io/help_center/collections.`
*/
export async function main(
auth: Intercom,
body: {
name: string
description?: string
translated_content?: {
type?: 'group_translated_content'
ar?: { type?: 'group_content'; name?: string; description?: string }
bg?: { type?: 'group_content'; name?: string; description?: string }
bs?: { type?: 'group_content'; name?: string; description?: string }
ca?: { type?: 'group_content'; name?: string; description?: string }
cs?: { type?: 'group_content'; name?: string; description?: string }
da?: { type?: 'group_content'; name?: string; description?: string }
de?: { type?: 'group_content'; name?: string; description?: string }
el?: { type?: 'group_content'; name?: string; description?: string }
en?: { type?: 'group_content'; name?: string; description?: string }
es?: { type?: 'group_content'; name?: string; description?: string }
et?: { type?: 'group_content'; name?: string; description?: string }
fi?: { type?: 'group_content'; name?: string; description?: string }
fr?: { type?: 'group_content'; name?: string; description?: string }
he?: { type?: 'group_content'; name?: string; description?: string }
hr?: { type?: 'group_content'; name?: string; description?: string }
hu?: { type?: 'group_content'; name?: string; description?: string }
id?: { type?: 'group_content'; name?: string; description?: string }
it?: { type?: 'group_content'; name?: string; description?: string }
ja?: { type?: 'group_content'; name?: string; description?: string }
ko?: { type?: 'group_content'; name?: string; description?: string }
lt?: { type?: 'group_content'; name?: string; description?: string }
lv?: { type?: 'group_content'; name?: string; description?: string }
mn?: { type?: 'group_content'; name?: string; description?: string }
nb?: { type?: 'group_content'; name?: string; description?: string }
nl?: { type?: 'group_content'; name?: string; description?: string }
pl?: { type?: 'group_content'; name?: string; description?: string }
pt?: { type?: 'group_content'; name?: string; description?: string }
ro?: { type?: 'group_content'; name?: string; description?: string }
ru?: { type?: 'group_content'; name?: string; description?: string }
sl?: { type?: 'group_content'; name?: string; description?: string }
sr?: { type?: 'group_content'; name?: string; description?: string }
sv?: { type?: 'group_content'; name?: string; description?: string }
tr?: { type?: 'group_content'; name?: string; description?: string }
vi?: { type?: 'group_content'; name?: string; description?: string }
'pt-BR'?: { type?: 'group_content'; name?: string; description?: string }
'zh-CN'?: { type?: 'group_content'; name?: string; description?: string }
'zh-TW'?: { type?: 'group_content'; name?: string; description?: string }
}
parent_id?: string
help_center_id?: number
}
) {
const url = new URL(`https://api.intercom.io/help_center/collections`)
const response = await fetch(url, {
method: 'POST',
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