//native
type Actimo = {
apiKey: string
}
export async function main(
auth: Actimo,
body: {
addr_city?: string
addr_country?: string
addr_line_1?: string
addr_line_2?: string
addr_state?: string
addr_zip?: string
company?: string
company_reg?: string
country_code?: string
data1?: string
data2?: string
data3?: string
department?: string
email?: string
employee_id?: number
first_name?: string
last_name?: string
manager_id?: number
manager_name?: string
manager_type?: string
phone_number?: string
timezone?: string
title?: string
'{data3-data20}'?: string
}
) {
const url = new URL(`https://actimo.com/api/v1/contacts`)
const response = await fetch(url, {
method: 'POST',
headers: {
'api-key': auth.apiKey,
'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 2 days ago