type Apollo = {
apiKey: string;
};
export async function main(
resource: Apollo,
accountIds: string[],
accountStageId: string
) {
const endpoint = "https://api.apollo.io/v1/accounts/bulk_update";
const body = {
account_ids: accountIds,
account_stage_id: accountStageId,
};
const response = await fetch(endpoint, {
method: "POST",
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.accounts;
}
Submitted by hugo697 79 days ago
type Apollo_io = {
apiKey: string
}
export async function main(resource: Apollo_io, accountIds: string[], accountStageId: string) {
const endpoint = 'https://api.apollo.io/v1/accounts/bulk_update'
const body = {
account_ids: accountIds,
account_stage_id: accountStageId
}
const response = await fetch(endpoint, {
method: 'POST',
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.accounts
}
Submitted by hugo697 79 days ago