Edits history of script submission #226 for ' Create Contact (hubspot)'

  • deno
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { Client } from "npm:@hubspot/api-client@^8.1.0";
    
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      company?: string,
      email?: string,
      firstname?: string,
      lastname?: string,
      phone?: string,
      website?: string,
    ) {
      const client = new Client({
        accessToken: auth.token,
      });
      const properties = removeObjectEmptyFields({
        company,
        email,
        firstname,
        lastname,
        phone,
        website,
      });
      try {
        return await client.crm.contacts.basicApi.create({ properties });
      } catch (e) {
        throw Error(`
          ${e.code} - ${e.body.category}\n
          Message: ${e.body.message}\n
          Correlation ID: ${e.body.correlationId}
        `);
      }
    }
    

    Submitted by hugo697 385 days ago

  • deno
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { Client } from "npm:@hubspot/api-client@^8.1.0";
    
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      company?: string,
      email?: string,
      firstname?: string,
      lastname?: string,
      phone?: string,
      website?: string,
    ) {
      const client = new Client({
        accessToken: auth.token,
      });
      const properties = removeObjectEmptyFields({
        company,
        email,
        firstname,
        lastname,
        phone,
        website,
      });
      try {
        return await client.crm.contacts.basicApi.create({ properties });
      } catch (e) {
        throw Error(`
          ${e.code} - ${e.body.category}\n
          Message: ${e.body.message}\n
          Correlation ID: ${e.body.correlationId}
        `);
      }
    }
    

    Submitted by admin 1017 days ago

  • deno
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts"
    import { Client } from "npm:@hubspot/api-client@^8.1.0"
    
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      company?: string,
      email?: string,
      firstname?: string,
      lastname?: string,
      phone?: string,
      website?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        company,
        email,
        firstname,
        lastname,
        phone,
        website
      })
      try {
        return await client.crm.contacts.basicApi.create({ properties });
      } catch (e) {
        throw Error(`
          ${e.code} - ${e.body.category}\n
          Message: ${e.body.message}\n
          Correlation ID: ${e.body.correlationId}
        `)
      }
    }
    

    Submitted by admin 1020 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts"
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts"
    import { Client } from "npm:@hubspot/api-client@^8.1.0"
    
    export async function main(
      auth: wmill.Resource<"hubspot">,
      company?: string,
      email?: string,
      firstname?: string,
      lastname?: string,
      phone?: string,
      website?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        company,
        email,
        firstname,
        lastname,
        phone,
        website
      })
      try {
        return await client.crm.contacts.basicApi.create({ properties });
      } catch (e) {
        throw Error(`
          ${e.code} - ${e.body.category}\n
          Message: ${e.body.message}\n
          Correlation ID: ${e.body.correlationId}
        `)
      }
    }
    

    Submitted by adam186 1149 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts"
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts"
    import { Client } from "npm:@hubspot/api-client@^8.1.0"
    
    export async function main(
      auth: wmill.Resource<"hubspot">,
      company?: string,
      email?: string,
      firstname?: string,
      lastname?: string,
      phone?: string,
      website?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        company,
        email,
        firstname,
        lastname,
        phone,
        website
      })
      try {
        return await client.crm.contacts.basicApi.create({ properties });
      } catch (e) {
        throw Error(`
          ${e.code} - ${e.body.category}\n
          Message: ${e.body.message}\n
          Correlation ID: ${e.body.correlationId}
        `)
      }
    }
    

    Submitted by adam186 1184 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts"
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts"
    import { Client } from "npm:@hubspot/api-client@^8.1.0"
    
    export async function main(
      auth: wmill.Resource<"hubspot">,
      company?: string,
      email?: string,
      firstname?: string,
      lastname?: string,
      phone?: string,
      website?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        company,
        email,
        firstname,
        lastname,
        phone,
        website
      })
      try {
        return await client.crm.contacts.basicApi.create({ properties });
      } catch (e) {
        throw Error(`
          ${e.code} - ${e.body.category}\n
          Message: ${e.body.message}\n
          Correlation ID: ${e.body.correlationId}
        `)
      }
    }
    

    Submitted by adam186 1268 days ago