Edits history of script submission #221 for ' Search Contacts (sendgrid)'

  • deno
    import sendgrid from "npm:@sendgrid/client@^7.7.0";
    
    /**
     * @param query The search query in SGQL format. An example query to get
     * all contacts with a Gmail address would look like the following:
     * `email LIKE '%gmail.com'`
     *
     * You can read more about SGQL at
     * https://docs.sendgrid.com/for-developers/sending-email/segmentation-query-language.
     *
     * You can read more about the endpoint at
     * https://docs.sendgrid.com/api-reference/contacts/search-contacts.
     */
    type Sendgrid = {
      token: string;
    };
    export async function main(api_token: Sendgrid, query: string) {
      sendgrid.setApiKey(api_token.token);
    
      const request = {
        url: `/v3/marketing/contacts/search`,
        method: "POST",
        body: { query },
      };
    
      try {
        const [_, body] = await sendgrid.request(request);
        return body;
      } catch (error) {
        throw Error("\n" + JSON.stringify(error?.response?.body || error));
      }
    }
    

    Submitted by hugo697 395 days ago

  • deno
    import sendgrid from "npm:@sendgrid/client@^7.7.0";
    
    /**
     * @param query The search query in SGQL format. An example query to get
     * all contacts with a Gmail address would look like the following:
     * `email LIKE '%gmail.com'`
     *
     * You can read more about SGQL at
     * https://docs.sendgrid.com/for-developers/sending-email/segmentation-query-language.
     *
     * You can read more about the endpoint at
     * https://docs.sendgrid.com/api-reference/contacts/search-contacts.
     */
    type Sendgrid = {
      token: string;
    };
    export async function main(api_token: Sendgrid, query: string) {
      sendgrid.setApiKey(api_token.token);
    
      const request = {
        url: `/v3/marketing/contacts/search`,
        method: "POST",
        body: { query },
      };
    
      try {
        const [_, body] = await sendgrid.request(request);
        return body;
      } catch (error) {
        throw Error("\n" + JSON.stringify(error?.response?.body || error));
      }
    }
    

    Submitted by admin 1028 days ago

  • deno
    import sendgrid from "npm:@sendgrid/client@^7.7.0"
    
    /**
     * @param query The search query in SGQL format. An example query to get 
     * all contacts with a Gmail address would look like the following: 
     * `email LIKE '%gmail.com'`
     * 
     * You can read more about SGQL at
     * https://docs.sendgrid.com/for-developers/sending-email/segmentation-query-language.
     * 
     * You can read more about the endpoint at 
     * https://docs.sendgrid.com/api-reference/contacts/search-contacts.
     */
    type Sendgrid = {
      token: string;
    };
    export async function main(
      api_token: Sendgrid,
      query: string,
    ) {
      sendgrid.setApiKey(api_token.token)
    
      const request = {
        url: `/v3/marketing/contacts/search`,
        method: 'POST',
        body: { query }
      }
    
      try {
        const [_, body] = await sendgrid.request(request)
        return body
      } catch (error) {
        throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
      }
    }
    

    Submitted by admin 1031 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts"
    import sendgrid from "npm:@sendgrid/client@^7.7.0"
    
    /**
     * @param query The search query in SGQL format. An example query to get 
     * all contacts with a Gmail address would look like the following: 
     * `email LIKE '%gmail.com'`
     * 
     * You can read more about SGQL at
     * https://docs.sendgrid.com/for-developers/sending-email/segmentation-query-language.
     * 
     * You can read more about the endpoint at 
     * https://docs.sendgrid.com/api-reference/contacts/search-contacts.
     */
    export async function main(
      api_token: wmill.Resource<"sendgrid">,
      query: string,
    ) {
      sendgrid.setApiKey(api_token.token)
    
      const request = {
        url: `/v3/marketing/contacts/search`,
        method: 'POST',
        body: { query }
      }
    
      try {
        const [_, body] = await sendgrid.request(request)
        return body
      } catch (error) {
        throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
      }
    }
    

    Submitted by adam186 1159 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts"
    import sendgrid from "npm:@sendgrid/client@^7.7.0"
    
    /**
     * @param query The search query in SGQL format. An example query to get 
     * all contacts with a Gmail address would look like the following: 
     * `email LIKE '%gmail.com'`
     * 
     * You can read more about SGQL at
     * https://docs.sendgrid.com/for-developers/sending-email/segmentation-query-language.
     * 
     * You can read more about the endpoint at 
     * https://docs.sendgrid.com/api-reference/contacts/search-contacts.
     */
    export async function main(
      api_token: wmill.Resource<"sendgrid">,
      query: string,
    ) {
      sendgrid.setApiKey(api_token.token)
    
      const request = {
        url: `/v3/marketing/contacts/search`,
        method: 'POST',
        body: { query }
      }
    
      try {
        const [_, body] = await sendgrid.request(request)
        return body
      } catch (error) {
        throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
      }
    }
    

    Submitted by adam186 1194 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts"
    import sendgrid from "npm:@sendgrid/client@^7.7.0"
    
    /**
     * @param query The search query in SGQL format. An example query to get 
     * all contacts with a Gmail address would look like the following: 
     * `email LIKE '%gmail.com'`
     * 
     * You can read more about SGQL at
     * https://docs.sendgrid.com/for-developers/sending-email/segmentation-query-language.
     * 
     * You can read more about the endpoint at 
     * https://docs.sendgrid.com/api-reference/contacts/search-contacts.
     */
    export async function main(
      api_token: wmill.Resource<"sendgrid">,
      query: string,
    ) {
      sendgrid.setApiKey(api_token.token)
    
      const request = {
        url: `/v3/marketing/contacts/search`,
        method: 'POST',
        body: { query }
      }
    
      try {
        const [_, body] = await sendgrid.request(request)
        return body
      } catch (error) {
        throw Error('\n' + (JSON.stringify(error?.response?.body || error)))
      }
    }
    

    Submitted by adam186 1282 days ago