Smartsheet webhook subscope weird behavior

10/05/21
Answered - Pending Review

I have a sheet on smartsheet that looks like this:



I wish that when `test_trigger` column in the sheet got changed, smartsheet can send a notification to my AWS API gateway.


So I use webhook with subscope to setup the notification.


However, I can't tell which cell in `test_trigger` column got changed from the request sent from smartsheet.


Here's the request I received when I change the second row of `test_trigger` column:


```

"webhookId":938672385222532,

"scope":"sheet",

"scopeObjectId":3981243399333764,

"events":

  [

    {"objectType":"cell","eventType":"created","rowId":2247170404575108,"columnId":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-04T09:30:21.000+0000"},

    {"objectType":"cell","eventType":"created","rowId":6750770031945604,"columnId":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-04T09:32:06.000+0000"},

    {"objectType":"cell","eventType":"created","rowId":4498970218260356,"columnId":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-04T09:32:06.000+0000"},

    {"objectType":"column","eventType":"updated","id":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-04T09:40:58.000+0000"},

    {"objectType":"cell","eventType":"created","rowId":9002569845630852,"columnId":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-04T09:40:58.000+0000"},

    {"objectType":"cell","eventType":"updated","rowId":2247170404575108,"columnId":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-04T09:40:58.000+0000"},

    {"objectType":"cell","eventType":"updated","rowId":4498970218260356,"columnId":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-04T09:40:58.000+0000"},

    {"objectType":"cell","eventType":"updated","rowId":6750770031945604,"columnId":180749923051396,"userId":273173041178XXX,"timestamp":"2021-10-05T02:02:00.000+0000"}

  ]

```


Does the request mean that when one of the cell in the column changes, the entire column was updated?


How can I use the information to identify which row changes?


Here's the code I used for creating the webhook:


```

webhook = smartsheet_client.Webhooks.create_webhook(

 smartsheet.models.Webhook({

  'name': 'My Webhook',

    'callbackUrl': 'https://myurl.execute-api.ap-southeast-1.amazonaws.com/debug',

  'scope': 'sheet',

  'scopeObjectId': target_sheet_id,

  'subscope': {

    "columnIds": [target_column_id]

  },

  'events': ['*.*'],

  'version': 1}))


```

Answers

  • Hi @SunnyPiano

    I can see the the column ID is the same for each of these events, so the subscope for that specific column in your webhook is working as expected.

    To answer your question, no, the entire column was not updated with this one change. It looks like the webhook had several changes to deliver (from different timestamps), which is why you received multiple "update" and "created" events.

    However, if you change one cell again, I believe the next response should only identify that one change since the previous updates have already been reported, now.

    Can you try again and see if there is only one event? It should include the RowID to let you know what row changed.

    Cheers,

    Genevieve

Sign In or Register to comment.