PipedreamHQ / pipedream

Connect APIs, remarkably fast. Free for developers.
https://pipedream.com
Other
8.32k stars 5.27k forks source link

Hubspot: New Event Sources #1419

Closed michelle0927 closed 2 years ago

michelle0927 commented 2 years ago

New Ticket | Triggers when a new ticket is available. New Line Item | Triggers when a new line item is available. New Product | Triggers when a new product is available. New Social Media Message | Triggers when a message is posted from HubSpot to the specified social media channel. Email Subscriptions Timeline | Triggers when new email timeline subscription added for the portal. Company Updated | Triggers when a company is modified. Line Item Updated | Triggers when a line item is modified. Product Updated | Triggers when a product is modified. Watch CRM Objects | Triggers when a CRM Object is created or modified.

Watch records is not included because it is essentially the same as Watch CRM Objects Watch Records | Triggers when a contact, a company, or a deal has been created or modified.

The following sources have not been included because the webhook to retrieve property changes requires exposing the app's API key. New Deal Property Change | Triggers when a specified property is provided or updated on a deal. New Ticket Property Change | Triggers when a specified property is provided or updated o a ticket. New Contact Property Change | Triggers when a specified property is provided or updated on a contact. New Company Property Change | Triggers when a specified property is provided or updated on a company.

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

pipedream-docs-redirect-do-not-edit – ./docs

πŸ” Inspect: https://vercel.com/pipedreamers/pipedream-docs-redirect-do-not-edit/3jCVf4yDRiUKzb5sRtE3SfLAyhVn
βœ… Preview: https://pipedream-docs-redirect-do-not-edit-git-hub-b4109e-pipedreamers.vercel.app

pipedream-docs – ./docs

πŸ” Inspect: https://vercel.com/pipedreamers/pipedream-docs/Dy6YBVYsJYLqEPQVtia7hmfv2c3w
βœ… Preview: https://pipedream-docs-git-hubspot-new-sources-pipedreamers.vercel.app

compwright commented 2 years ago

@michelle0927 circling back on this. I didn't see where you responded or addressed these items. Are you still working on this, or if I've missed your response could you point me to it?

  • [ ] In the following sources, the last dedupe strategy is a better fit. Use the record id as the event id, and do not append the timestamp to the event ID. No need to check timestamps in isRelevant() when using this strategy, Pipedream will handle that for you.

    • [ ] *-updated
    • [ ] new-email-subscriptions-timeline
    • [ ] new-form-submission
    • [ ] new-or-updated-crm-object
  • [ ] Timestamp comparison in isRelevant() is redundant when using the unique dedupe strategy:

    • [ ] new-company
    • [ ] new-contact
    • [ ] new-deal-in-stage
    • [ ] new-deal
    • [ ] new-engagement
    • [ ] new-line-item
    • [ ] new-product
    • [ ] new-social-media-message
    • [ ] new-ticket
michelle0927 commented 2 years ago

@compwright

Screen Shot 2021-10-15 at 11 24 57 AM Screen Shot 2021-10-15 at 11 25 09 AM
vellames commented 2 years ago

Hey @michelle0927, do you still working on this PR? Can I start a new review here or it's not necessary?

michelle0927 commented 2 years ago

Hey @michelle0927, do you still working on this PR? Can I start a new review here or it's not necessary?

Yes, you can start a new review. I'm not sure what happened to the previous reviewer. :)

michelle0927 commented 2 years ago

The New Deal In Stage trigger was only allowing users to select stages from the default pipeline. To accommodate users with multiple pipelines, a pipeline prop has been added. The user selects a pipeline, and the stages prop then lists only stages from that pipeline.

dannyroosevelt commented 2 years ago

@michelle0927

➜  new-ticket git:(hubspot-new-sources) pd dev new-ticket.mjs
watch:add     | /Users/danny/Code/pipedream/components/hubspot/sources/new-ticket/new-ticket.mjs
watch:add     | /Users/danny/Code/pipedream/components/hubspot/sources/common.mjs
watch:add     | /Users/danny/Code/pipedream/components/hubspot/hubspot.app.mjs
Detected local requires, creating zip archive...
- sources/new-ticket/new-ticket.mjs
- sources/common.mjs
- hubspot.app.mjs
Configuring props...
Configuring prop hubspot...
panic: graphql: Cannot return null for non-nullable field Selectable.label

goroutine 45 [running]:
pd/core.determineAppAuthProvisionID(0xc00051dc90, 0x7, 0xc00051dc97, 0x3, 0x0, 0xc00051dca0, 0x7, 0x0, 0x0, 0x0, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:54 +0x2d1
pd/core.configureAppProp(0xc00051dc90, 0x7, 0xc00051dc97, 0x3, 0x0, 0xc00051dca0, 0x7, 0x0, 0x0, 0x0, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:152 +0x1b5
pd/core.configureProp(0x0, 0x0, 0xc0002a4cc0, 0x40, 0xc000021b00, 0x3, 0x4, 0xc00051dc70, 0xa, 0xc00051dc80, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:303 +0x264b
pd/core.ConfigureProps(0x0, 0x0, 0xc0002a4cc0, 0x40, 0xc000021b00, 0x3, 0x4, 0xc00051dc70, 0xa, 0xc00051dc80, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:500 +0x1b8
pd/cmd.glob..func6.3.1(0x7ff7bfeffaa7, 0xe, 0xc000208300, 0xc0000b0de0, 0xc000208320, 0xc0000ac0f8, 0xc0000ac100, 0xc000439ec0, 0x1004fec)
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:174 +0x269
pd/cmd.glob..func6.3()
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:215 +0x72
pd/cmd.glob..func6.4(0xc000336280, 0xc0000a82a0, 0xc0000ac0f0)
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:224 +0x3f
created by pd/cmd.glob..func6
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:223 +0x56a
js07 commented 2 years ago
➜  new-ticket git:(hubspot-new-sources) pd dev new-ticket.mjs
...
panic: graphql: Cannot return null for non-nullable field Selectable.label

@dannyroosevelt I don't know why that bug happens with pd dev, but I think you could use the workaround (using pd publish) described in https://github.com/PipedreamHQ/pipedream/pull/1881#issuecomment-961422788, for now?

dannyroosevelt commented 2 years ago
➜  new-ticket git:(hubspot-new-sources) pd dev new-ticket.mjs
...
panic: graphql: Cannot return null for non-nullable field Selectable.label

@dannyroosevelt I don't know why that bug happens with pd dev, but I think you could use the workaround (using pd publish) described in #1881 (comment), for now?

Ah thanks for the workaround πŸ˜„ I got the source configured, but I get an error when a new event should come in (new ticket created): image

dannyroosevelt commented 2 years ago

I also get an error after configuring new-product image

dannyroosevelt commented 2 years ago

well I'm no longer running into the above issues. perhaps my auth was in a weird state at the time. I'll pick up the QA again asap.

dannyroosevelt commented 2 years ago

@michelle0927 I get an error when trying to create the contact-updated source after I've pd published it to my account: image

And I get this error when running pd dev -- any clues?


➜  contact-updated git:(hubspot-new-sources) βœ— pd dev contact-updated.mjs
watch:add     | /Users/danny/Code/pipedream/components/hubspot/sources/contact-updated/contact-updated.mjs
watch:add     | /Users/danny/Code/pipedream/components/hubspot/sources/common.mjs
watch:add     | /Users/danny/Code/pipedream/components/hubspot/hubspot.app.mjs
Detected local requires, creating zip archive...
- sources/contact-updated/contact-updated.mjs
- sources/common.mjs
- hubspot.app.mjs
Configuring props...
Configuring prop hubspot...
panic: graphql: Cannot return null for non-nullable field Selectable.label

goroutine 45 [running]:
pd/core.determineAppAuthProvisionID(0xc00038c590, 0x7, 0xc00038c597, 0x3, 0x0, 0xc00038c5b0, 0x7, 0x0, 0x0, 0x0, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:54 +0x2d1
pd/core.configureAppProp(0xc00038c590, 0x7, 0xc00038c597, 0x3, 0x0, 0xc00038c5b0, 0x7, 0x0, 0x0, 0x0, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:152 +0x1b5
pd/core.configureProp(0x0, 0x0, 0xc000022240, 0x40, 0xc00022c6c0, 0x3, 0x4, 0xc00038c550, 0xa, 0xc00038c560, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:303 +0x264b
pd/core.ConfigureProps(0x0, 0x0, 0xc000022240, 0x40, 0xc00022c6c0, 0x3, 0x4, 0xc00038c550, 0xa, 0xc00038c560, ...)
    /home/runner/work/pipedreamin/pipedreamin/cli/core/configure_props.go:500 +0x1b8
pd/cmd.glob..func6.3.1(0x7ff7bfeffa9f, 0x13, 0xc000353c20, 0xc0003bf230, 0xc000353c40, 0xc0000a60e0, 0xc0000a60e8, 0xc00013ae68, 0x0)
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:174 +0x269
pd/cmd.glob..func6.3()
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:215 +0x72
pd/cmd.glob..func6.4(0xc000222700, 0xc000526f00, 0xc0000a60d8)
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:224 +0x3f
created by pd/cmd.glob..func6
    /home/runner/work/pipedreamin/pipedreamin/cli/cmd/dev.go:223 +0x56a
DilanAthukorala commented 2 years ago

No events were triggered while testing this app. @michelle0927 Please check.

michelle0927 commented 2 years ago

No events were triggered while testing this app. @michelle0927 Please check.

That's correct. This is blocked - https://pipedream-users.slack.com/archives/CPTJYRY5A/p1647895750121889

michelle0927 commented 2 years ago

These sources will be refactored to use Hubspot's REST API.

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated
pipedream-docs βœ… Ready (Inspect) Visit Preview May 6, 2022 at 8:10PM (UTC)
pipedream-docs-redirect-do-not-edit βœ… Ready (Inspect) Visit Preview May 6, 2022 at 8:10PM (UTC)
DilanAthukorala commented 2 years ago

@michelle0927 I am observing the following error for Company Updated and Deal Updated sources

image

[debug] err.response {
  "status": 403,
  "statusText": "Forbidden",
  "headers": {
    "date": "Tue, 10 May 2022 17:50:27 GMT",
    "content-type": "application/json;charset=utf-8",
    "content-length": "434",
    "connection": "close",
    "cf-ray": "709484709bad8251-IAD",
    "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
    "vary": "Accept-Encoding",
    "cf-cache-status": "DYNAMIC",
    "access-control-allow-credentials": "false",
    "expect-ct": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"",
    "x-hubspot-correlation-id": "13c40ed5-64d3-4a4a-b915-f211bad08136",
    "x-trace": "2BA578CA1AF0EBCCC5330DC3C35EB11FF5D8980F52000000000000000000",
    "report-to": "{\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v3?s=eo0%2BiyUys0oyqJsUxmwstTNFeH8etxlZPv3RMGk2vvAl4LQwZjQfktSUD%2B1KXqAdrsSqrkadyIALUxNj%2B4vAWUG85adElEKELzxmvIqcOK5rab5pxkgZ8Iugrn8cmjYy\"}],\"group\":\"cf-nel\",\"max_age\":604800}",
    "nel": "{\"success_fraction\":0.01,\"report_to\":\"cf-nel\",\"max_age\":604800}",
    "server": "cloudflare",
    "alt-svc": "h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400"
  },
  "config": {
    "url": "https://api.hubapi.com/crm/v3/objects/companies/search",
    "method": "post",
    "data": "{\"limit\":100,\"sorts\":[{\"propertyName\":\"hs_lastmodifieddate\",\"direction\":\"DESCENDING\"}]}",
    "headers": {
      "Accept": "application/json, text/plain, */*",
      "Content-Type": "application/json",
      "Authorization": "Bearer CKH4mPmKMBIM2oeDUUBA4QAAAAAkGIOduQogyYCyFSiC3gwyFEIRlz3e_7xty8Gfjq6hv1Enm29UOjAANWXH_wcABNz_83_g_3xGPIYAACAGABQcDCA4HA4A8MP_JwEAACCBpwMHwAAAkApCFECxGQTheq2MO8BXCxkeB_iQ00_MSgNuYTFSAFoA",
      "User-Agent": "axios/0.19.2",
      "Content-Length": 87
    },
    "transformRequest": [
      null
    ],
    "transformResponse": [
      null
    ],
    "timeout": 0,
    "xsrfCookieName": "XSRF-TOKEN",
    "xsrfHeaderName": "X-XSRF-TOKEN",
    "maxContentLength": -1
  },
  "data": {
    "status": "error",
    "message": "This app hasn't been granted all required scopes to make this call. Read more about required scopes here: https://developers.hubspot.com/scopes.",
    "correlationId": "13c40ed5-64d3-4a4a-b915-f211bad08136",
    "errors": [
      {
        "message": "One or more of the following scopes are required.",
        "context": {
          "requiredScopes": [
            "contacts"
          ]
        }
      }
    ],
    "links": {
      "scopes": "https://developers.hubspot.com/scopes"
    },
    "category": "MISSING_SCOPES"
  }
}
michelle0927 commented 2 years ago

@DilanAthukorala I'm not seeing that error. Does your Hubspot account in Pipedream show the same scopes as mine?

Screen Shot 2022-05-10 at 2 23 22 PM
DilanAthukorala commented 2 years ago

@DilanAthukorala I'm not seeing that error. Does your Hubspot account in Pipedream show the same scopes as mine? Screen Shot 2022-05-10 at 2 23 22 PM

@michelle0927 Yes same scopes are shown in mine image

dannyroosevelt commented 2 years ago

Strange. @DilanAthukorala can you try reconnecting your HubSpot account and trying again? I just modified the set of scopes in our HubSpot OAuth integration, based on some changes in their spec.

DilanAthukorala commented 2 years ago

Strange. @DilanAthukorala can you try reconnecting your HubSpot account and trying again? I just modified the set of scopes in our HubSpot OAuth integration, based on some changes in their spec.

@dannyroosevelt Now it's working, Thank you!

DilanAthukorala commented 2 years ago

@michelle0927 I'm unable to deploy the source for new-form-submission, getting the below error;

image

michelle0927 commented 2 years ago

@michelle0927 I'm unable to deploy the source for new-form-submission, getting the below error;

Looks like this is due to an issue with the CLI (https://pipedream-users.slack.com/archives/G01J50YGJGP/p1652282923205609). Can you try publishing the source and deploying it from the UI?

DilanAthukorala commented 2 years ago

Verification completed and no issues observed.