type Campayn = {
apiKey: string
}
export async function main(resource: Campayn, contactId: string) {
const endpoint = `https://campayn.com/api/v1/contacts/${contactId}.json`
const response = await fetch(endpoint, {
method: 'GET',
headers: {
Authorization: `TRUEREST apikey=${resource.apiKey}`
}
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data
}
Submitted by hugo697 79 days ago