Enable Webhook Responds 404 Not Found
Hi Guys,
I am new to creating webhooks so I apologize if this is something simple. I am using C# to register my webhook with the api. That works as intended.
Then, I am calling all of the webhooks for the sheet using
`SheetResources.ListSheets(null, null, null)` which also returns the list of webhooks fine.
Then I am retrieving the webhook Id from this result
Then I am attempting to "enable" the webhook using
WebhookResources.UpdateWebhook(Options)
<--- this is where it gives me 404 not found
I am not sure what I am going wrong here.
Any advice to check?
Answers
-
Hi @gmedia
As per docs:
A webhook is not enabled by default when it is created. Once you've created a webhook, you can enable it by using the Update Webhook operation to set enabled to true.
The ID of the webhook you can find in the response when you create a webhook.
Or you can call https://api.smartsheet.com/2.0/webhooks
Loop over the response to find your webhook ID based on the "scopeObjectId" which is your sheet ID. Then Update webhook to Enable it:
https://api.smartsheet.com/2.0/webhooks/{webhookId}
Follow the docs and you should be ok.
-
That is exactly what I am doing. I am trying to "enable" the webhook by using the update. The request to update it is failing
Webhook Options = new Webhook();
Options.Id = WebhookId;
Options.Enabled = isEnabled;
UpdatedWebhook = this._Client.WebhookResources.UpdateWebhook(Options);
-
check your "callbackUrl". Are you sure the endpoint is set correctly to receive the request? Also, are you returning the WebhookChallenge code if required?
To debug this I would log any incoming requests at the callbackUrl and check if one was received from Smartsheet after you send the updateWebhook request.
It's hard to help without understanding how your endpoint is configured.
-
I'm not sure if I have the callback function correct. How should it be set in C#
private static async Task<IResult> SpreadsheetEvent(HttpContext HttpCtxt)
{
Console.WriteLine(HttpCtxt.Request.Headers.ToString());
return Results.Ok();
}
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 460 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives