type Apollo = {
apiKey: string;
};
export async function main(
resource: Apollo,
contactId: string,
body: {
first_name?: string;
last_name?: string;
title?: string;
organization_name?: string;
account_id?: string;
email?: string;
label_names?: string[];
present_raw_address?: string;
direct_phone?: string;
corporate_phone?: string;
mobile_phone?: string;
home_phone?: string;
other_phone?: string;
}
) {
const endpoint = `https://api.apollo.io/v1/contacts/${contactId}`;
const response = await fetch(endpoint, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache",
"X-Api-Key": resource.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.contact;
}
Submitted by hugo697 76 days ago
type Apollo_io = {
apiKey: string
}
export async function main(
resource: Apollo_io,
contactId: string,
body: {
first_name?: string
last_name?: string
title?: string
organization_name?: string
account_id?: string
email?: string
label_names?: string[]
present_raw_address?: string
direct_phone?: string
corporate_phone?: string
mobile_phone?: string
home_phone?: string
other_phone?: string
}
) {
const endpoint = `https://api.apollo.io/v1/contacts/${contactId}`
const response = await fetch(endpoint, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'Cache-Control': 'no-cache',
'X-Api-Key': resource.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.json()
return data.contact
}
Submitted by hugo697 76 days ago