Edits history of script submission #229 for ' Create Deal (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";
    
    /**
     * @param closedate Uses the following date-time format:
     * `2019-12-07T16:50:06.678Z` but time value can be omitted.
     */
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      amount?: string,
      closedate?: string,
      dealname?: string,
      dealstage?: string,
      hubspot_owner_id?: string,
      pipeline?: string,
    ) {
      const client = new Client({
        accessToken: auth.token,
      });
      const properties = removeObjectEmptyFields({
        amount,
        closedate,
        dealname,
        dealstage,
        hubspot_owner_id,
        pipeline,
      });
      try {
        return await client.crm.deals.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 378 days ago

  • deno
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts";
    import { Client } from "npm:@hubspot/api-client@^8.1.0";
    
    /**
     * @param closedate Uses the following date-time format:
     * `2019-12-07T16:50:06.678Z` but time value can be omitted.
     */
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      amount?: string,
      closedate?: string,
      dealname?: string,
      dealstage?: string,
      hubspot_owner_id?: string,
      pipeline?: string,
    ) {
      const client = new Client({
        accessToken: auth.token,
      });
      const properties = removeObjectEmptyFields({
        amount,
        closedate,
        dealname,
        dealstage,
        hubspot_owner_id,
        pipeline,
      });
      try {
        return await client.crm.deals.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 1011 days ago

  • deno
    import { removeObjectEmptyFields } from "https://deno.land/x/[email protected]/mod.ts"
    import { Client } from "npm:@hubspot/api-client@^8.1.0"
    
    /**
     * @param closedate Uses the following date-time format: 
     * `2019-12-07T16:50:06.678Z` but time value can be omitted.
     */
    type Hubspot = {
      token: string;
    };
    export async function main(
      auth: Hubspot,
      amount?: string,
      closedate?: string,
      dealname?: string,
      dealstage?: string,
      hubspot_owner_id?: string,
      pipeline?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        amount,
        closedate,
        dealname,
        dealstage,
        hubspot_owner_id,
        pipeline
      })
      try {
        return await client.crm.deals.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 1014 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"
    
    /**
     * @param closedate Uses the following date-time format: 
     * `2019-12-07T16:50:06.678Z` but time value can be omitted.
     */
    export async function main(
      auth: wmill.Resource<"hubspot">,
      amount?: string,
      closedate?: string,
      dealname?: string,
      dealstage?: string,
      hubspot_owner_id?: string,
      pipeline?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        amount,
        closedate,
        dealname,
        dealstage,
        hubspot_owner_id,
        pipeline
      })
      try {
        return await client.crm.deals.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 1142 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"
    
    /**
     * @param closedate Uses the following date-time format: 
     * `2019-12-07T16:50:06.678Z` but time value can be omitted.
     */
    export async function main(
      auth: wmill.Resource<"hubspot">,
      amount?: string,
      closedate?: string,
      dealname?: string,
      dealstage?: string,
      hubspot_owner_id?: string,
      pipeline?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        amount,
        closedate,
        dealname,
        dealstage,
        hubspot_owner_id,
        pipeline
      })
      try {
        return await client.crm.deals.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 1177 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"
    
    /**
     * @param closedate Uses the following date-time format: 
     * `2019-12-07T16:50:06.678Z` but time value can be omitted.
     */
    export async function main(
      auth: wmill.Resource<"hubspot">,
      amount?: string,
      closedate?: string,
      dealname?: string,
      dealstage?: string,
      hubspot_owner_id?: string,
      pipeline?: string
    ) {
      const client = new Client({
        accessToken: auth.token
      })
      const properties = removeObjectEmptyFields({
        amount,
        closedate,
        dealname,
        dealstage,
        hubspot_owner_id,
        pipeline
      })
      try {
        return await client.crm.deals.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 1261 days ago