Why is the row id in the webhook data different to the smartsheet row id?

Heres my webhook code

$challenge = file_get_contents('php://input');

$result = json_decode($challenge);

$Response = $result->challenge;

$WebHookId = $result->webhookId;

header("Authorization: Bearer".SS_TOKEN);

header('Smartsheet-Hook-Response:'.$Response);

http_response_code(200);

$events = $result->events;

foreach($events as $item){

if ($item->objectType == 'row' && $item->eventType =='created'){

(int)$rowID = $item->id;

break;// leave loop after row Id obtained

}

}

I'm emailing the $events data to myself and I get the following:

[{"objectType":"row","eventType":"created","id":6260377225717636,"userId":3106431567193988,"timestamp":"2022-04-28T15:55:02.000+00:00"},{"objectType":"row","eventType":"updated","id":129455292082052,"userId":3106431567193988,"timestamp":"2022-04-28T15:55:02.000+00:00"},{"objectType":"row","eventType":"created","id":6647903534901124,"userId":3106431567193988,"timestamp":"2022-04-28T15:58:39.000+00:00"},{"objectType":"row","eventType":"updated","id":6260377225717636,"userId":3106431567193988,"timestamp":"2022-04-28T15:58:39.000+00:00"},{"objectType":"row","eventType":"updated","id":1995583549138820,"userId":3106431567193988,"timestamp":"2022-04-28T16:01:02.000+00:00"},{"objectType":"row","eventType":"deleted","id":3458390759237508,"userId":3106431567193988,"timestamp":"2022-04-28T16:01:02.000+00:00"},{"objectType":"row","eventType":"deleted","id":129455292082052,"userId":3106431567193988,"timestamp":"2022-04-28T16:01:02.000+00:00"},{"objectType":"row","eventType":"deleted","id":3592060878907268,"userId":3106431567193988,"timestamp":"2022-04-28T16:01:02.000+00:00"}, ..............more

When I look at the properties for the sheet the row created has an id of 1612139205945220

What's happening??

Best Answer

  • Genevieve P.
    Genevieve P. Employee
    Answer ✓

    Hi @James Dudley

    From what I gather, it looks like you're looping through webhook events data and pulling out row ID for created events. If so, I don't know why the row ID in the sheet would differ from the one in the webhook event.

    Is it possible that you are looking at the wrong row or ID somehow? For example, if you received a row created event, but that same row was deleted before you compared it to the id in the sheet itself, you might end up looking at a different row and different id.

    If this isn't the case, I would recommend troubleshooting this with Smartsheet Support so you can provide them with additional details and screen captures in a private channel.

    Cheers,

    Genevieve

    Need more help? 👀 | Help and Learning Center

    こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions

Answers