//native
type Adhook = {
token: string
}
export async function main(
auth: Adhook,
adhookToken: string,
body: {
promotionId?: string
imageUrl?: string
accountId?: string
subtenantId?: string
}
) {
const url = new URL(`https://app.adhook.io/v1/promotions/facebook/image`)
const response = await fetch(url, {
method: 'POST',
headers: {
adhookToken: adhookToken,
Authorization: `Bearer ${auth.token}`,
'Content-Type': 'application/json'
},
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 223 days ago