Search for sequences in Apollo.io. See the documentation
1
type Apollo = {
2
apiKey: string;
3
};
4
5
export async function main(resource: Apollo, search: string) {
6
const endpoint = "https://api.apollo.io/v1/emailer_campaigns/search";
7
const body = {
8
q_name: search,
9
10
11
const response = await fetch(endpoint, {
12
method: "POST",
13
headers: {
14
"Content-Type": "application/json",
15
"Cache-Control": "no-cache",
16
"X-Api-Key": resource.apiKey,
17
},
18
body: JSON.stringify(body),
19
});
20
21
if (!response.ok) {
22
throw new Error(`HTTP error! status: ${response.status}`);
23
}
24
25
const data = await response.json();
26
27
return data.emailer_campaigns;
28
29