//native
type SageIntacct = {
token: string
}
/**
* Create a contact
* Creates a new contact. The contact's `entity` fields will be set to the entity that the OAuth access token is associated with when the contact is created.
Permissions and other requirements
SubscriptionCompany
User typeBusiness user with admin privileges
PermissionsAdd Contacts
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
href?: string
lastName?: string
firstName?: string
middleName?: string
prefix?: string
email1?: string
email2?: string
phone1?: string
phone2?: string
mobile?: string
pager?: string
fax?: string
URL1?: string
URL2?: string
companyName?: string
printAs?: string
showInContactList?: false | true
discount?: string
status?: 'active' | 'inactive'
entity?: { key?: string; id?: string; name?: string; href?: string }
mailingAddress?: {
addressLine1?: string
addressLine2?: string
addressLine3?: string
city?: string
state?: string
postCode?: string
country?: string
isoCountryCode?: string
}
priceList?: { key?: string; id?: string; href?: string }
priceSchedule?: { key?: string; id?: string; href?: string }
tax?: {
isTaxable?: false | true
taxId?: string
group?: { key?: string; id?: string; href?: string }
}
} & {}
) {
const url = new URL(`https://api.intacct.com/ia/api/v1/objects/company-config/contact`)
const response = await fetch(url, {
method: 'POST',
headers: {
'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 235 days ago