//native
/**
* Unarchive Thread
* Restore an archived conversation thread. Requires conversations.write.
*/
export async function main(auth: RT.Hubspot, thread_id: string) {
const response = await fetch(
`https://api.hubapi.com/conversations/v3/conversations/threads/${thread_id}?archived=true`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ archived: false }),
}
)
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago