APIs & Integrations

a_funs
Contributor

Available properties to listen to on Line Item webhook

SOLVE

Hi, why are there virtually no valuable properties on Line Items to listen to available to webhooks? Pretty useless with the three properties below.

 

Screenshot 2023-08-28 at 5.40.46 PM.png

  

1 Accepted solution
a_funs
Solution
Contributor

Available properties to listen to on Line Item webhook

SOLVE

Instead of the back and forth below, you ARE able to do this via the UI, for some reason the various properties will just not populate in the dropdown. However, by putting the correct property name into the search box and pressing "enter" you can successfully create subscriptions to property changes of Line Items. Seems to just be an issue with the property options populating to the dropdown. For example, see "price" below

 

Screenshot 2023-08-29 at 12.11.58 PM.png

View solution in original post

0 Upvotes
8 Replies 8
a_funs
Solution
Contributor

Available properties to listen to on Line Item webhook

SOLVE

Instead of the back and forth below, you ARE able to do this via the UI, for some reason the various properties will just not populate in the dropdown. However, by putting the correct property name into the search box and pressing "enter" you can successfully create subscriptions to property changes of Line Items. Seems to just be an issue with the property options populating to the dropdown. For example, see "price" below

 

Screenshot 2023-08-29 at 12.11.58 PM.png

0 Upvotes
coldrickjack
Guide

Available properties to listen to on Line Item webhook

SOLVE

Hey @a_funs,

 

I've come up against this a few times and the UI is a little misleading... You can create subscriptions to more than the list supplied (both default and custom properties).  For instance I've created a webhook for anytime the "term" (hs_recurring_billling_period) is updated for a line item and it works just fine. 

 

Screenshot 2023-08-28 at 23.19.42.png

 

See the payload I get when the term is updated via the HubSpot UI:

 

Screenshot 2023-08-28 at 23.18.37.png

 

In short anything you pull from GET /crm/v3/properties/line_items (Properties API) can be used to configure a webhook providing you include the interal name of the property when setting up the webhook via your app settings.

 

Hope this helps! 

0 Upvotes
a_funs
Contributor

Available properties to listen to on Line Item webhook

SOLVE

Thanks @coldrickjack

I actually thought of this and attempted to subscribe to other properties not visible in the UI via the api. However,  despite my app key having access to every scope possible, I still get a scope error when trying to edit webhooks via api. How were you able to create the subscriptions to other properties? If via api, do you know what scopes are required to access those endpoints?

 

 

 

"message": "The scope needed for this API call isn't available for public use. If you have questions, contact support or post in our developer forum."

 

 

 

0 Upvotes
coldrickjack
Guide

Available properties to listen to on Line Item webhook

SOLVE

Hey @a_funs,

 

For me adding the 'ecommerce' scope did the job. 🤔

0 Upvotes
a_funs
Contributor

Available properties to listen to on Line Item webhook

SOLVE

@coldrickjack That's the scope needed to access the endpoints which edit webhook subscriptions? I am getting the error when I attempt to view or edit webhook subscriptions: https://developers.hubspot.com/docs/api/webhooks

0 Upvotes
coldrickjack
Guide

Available properties to listen to on Line Item webhook

SOLVE

Hey @a_funs

 

I know as per the documentation here the "e-commerce" scope is defined as giving access to "Products and line items endpoints". However it also applies to when you are configuring a webhook for a Line item. For instance when I was creating a webhook via the UI (as opposed to the API) I was prompted to add the e-commerce scope. See the screenshot below. It also specifies that it's a required scope from the scopes listed in this table here

Screenshot 2023-08-29 at 09.15.24.png

Once I set the scope up, activated the webhook and re-installed my app I started seeing events coming from HubSpot to my endpoint. (as per screenshot in my original post).

 

When viewing or editing webhook subscriptions via the Webhook API you just use developer portal API key. You do however need to make sure you've configured your scopes for the app from within the app settings interface (auth tab). See mine below: 

 

Screenshot 2023-08-29 at 09.38.03.png

 

Providing you've the appropriate scopes in place dependent on the type of object(s) your subscriptions are going to be configured for you can retrieve webhooks making a GET as per below:

 

GET https://api.hubapi.com/webhooks/v3/{{APP_ID}}/subscriptions?hapikey={{DEV_API_KEY}}
RESPONSE
{
    "results": [
        {
            "eventType": "contact.creation",
            "propertyName": null,
            "active": true,
            "id": "2185980",
            "createdAt": "2023-07-20T16:24:55.629Z",
            "updatedAt": null
        },
        {
            "eventType": "company.propertyChange",
            "propertyName": "notes_last_updated",
            "active": true,
            "id": "2219950",
            "createdAt": "2023-08-11T14:23:19.117Z",
            "updatedAt": null
        },
        {
            "eventType": "line_item.propertyChange",
            "propertyName": "hs_recurring_billing_period",
            "active": true,
            "id": "2245350",
            "createdAt": "2023-08-28T22:14:07.184Z",
            "updatedAt": null
        },
        {
            "eventType": "line_item.creation",
            "propertyName": null,
            "active": true,
            "id": "2245363",
            "createdAt": "2023-08-28T22:16:01.377Z",
            "updatedAt": null
        }
    ]
}

 

You can also update any one of those subscriptions, for instance pausing the "line_item.creation" subscription:

 

PATCH https://api.hubapi.com/webhooks/v3/{{APP_ID}}/subscriptions/{{SUB_ID}}?hapikey={{DEV_API_KEY}}
BODY
{ "active": false }
RESPONSE
{
    "eventType": "line_item.creation",
    "propertyName": null,
    "active": false,
    "id": "2245363",
    "createdAt": "2023-08-28T22:16:01.377Z",
    "updatedAt": null
}

 

Or you could create a brand new one to listen for changes to another "line_item" property:

 

GET https://api.hubapi.com/webhooks/v3/{{APP_ID}}/subscriptions?hapikey={{DEV_API_KEY}}
BODY:
{
  "active": true,
  "eventType": "line_item.propertyChange",
  "propertyName": "quantity"
}
RESPONSE:
{
    "eventType": "line_item.propertyChange",
    "propertyName": "quantity",
    "active": true,
    "id": "2245553",
    "createdAt": "2023-08-29T08:33:19.006Z",
    "updatedAt": null
}

 

Hope this helps! 

0 Upvotes
a_funs
Contributor

Available properties to listen to on Line Item webhook

SOLVE

Thank @coldrickjack for taking the time to help with this. I think the issue may be that I was attempting to use a private app, and private app webhook subscriptions can not be edited by api currently. There is a little disclaimer here: https://developers.hubspot.com/docs/api/webhooks

 

"

Please note: 

  • Webhook support for private apps is currently in beta. Note that during this beta, webhook settings can only be edited in the in-app settings for your private app, and cannot currently be edited through the API."
coldrickjack
Guide

Available properties to listen to on Line Item webhook

SOLVE

Ah ok yeah if that is the case then that is definitely the issue! 😊 Best of luck with things moving forward

0 Upvotes