Edits history of script submission #22502 for ' Get Contacts Job Status (sendgrid)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import sendgrid from "@sendgrid/client@^7.7.0";
    
    type Sendgrid = {
      token: string;
    };
    export async function main(api_token: Sendgrid, job_id: string) {
      sendgrid.setApiKey(api_token.token);
    
      const request = {
        url: `/v3/marketing/contacts/imports/${job_id}`,
        method: "GET",
      };
    
      try {
        const [_, body] = await sendgrid.request(request);
        return body;
      } catch (error) {
        throw Error("\n" + JSON.stringify(error?.response?.body || error));
      }
    }
    

    Submitted by hugo989 3 days ago