Edits history of script submission #8971 for ' Update Contact Stage (apollo)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Apollo = {
      apiKey: string;
    };
    
    export async function main(
      resource: Apollo,
      contactIds: string[],
      contactStageId: string
    ) {
      const endpoint = "https://api.apollo.io/v1/contacts/update_stages";
      const body = {
        contact_ids: contactIds,
        contact_stage_id: contactStageId,
      };
    
      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.contacts;
    }
    

    Submitted by hugo697 650 days ago

  • nativets
    type Apollo_io = {
    	apiKey: string
    }
    
    export async function main(resource: Apollo_io, contactIds: string[], contactStageId: string) {
    	const endpoint = 'https://api.apollo.io/v1/contacts/update_stages'
    	const body = {
    		contact_ids: contactIds,
    		contact_stage_id: contactStageId
    	}
    
    	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.contacts
    }
    

    Submitted by hugo697 650 days ago