Help! Webhook Creation Error
Hello!
I'm able to use my api key to retrieve my sheet, and then the /webhook GET request successfully responds with an empty set, but I'm unable to add the hook for some reason. Any help would be appreciated! I've tried adding the non-required fields shown in the docs (createdAt, modifiedAt, subscope) and I've tried setting the enabled flag to false (who knows) each resulting with the same error.
Thanks y'all.
Best Answer
-
Thank you this is helpful - the POST call I'm making is the equivalent of your CreateWebhook() call.
Interestingly, their documentation states: "Currently, must be an array of size 1 that contains the string value ".", which means "all objects" and "all events"." -- and their example code had:
"events": ["*"]
Both of which are incorrect! I tried your value of
"events": ["*.*"]
and that worked! Thank you!
If the API docs team is reading, please update the docs!
Answers
-
We have a two stage process (I'm afraid this is c# from our api wrapper)
long inpHook = await smartSrv.CreateWebHook(sheetId);
Assert.NotEqual(0, inpHook);
long rtnHook = await smartSrv.EnableWebHook(sheetId, inpHook);
Assert.NotEqual(0, rtnHook);
Create does this:
// Webhook specification
Webhook webhook = new Webhook
{
Name = "APD Webhook",
CallbackUrl = awsCred.SmartAPIString,
Scope = "sheet",
ScopeObjectId = sheetId,
Events = new string[] { "*.*" },
Version = 1
};
// Create Webhook
Webhook newWebhook = smartsheet.WebhookResources.CreateWebhook(
webhook
);
hookId = (long)newWebhook.Id;
// hookId allows us to pass value to enable.
Enable does this:
Webhook webhook = new Webhook
{
Id = webhookId,
CallbackUrl = awsCred.SmartAPIString,
Version = 1,
Enabled = true
};
// Update Webhook
Webhook updatedWebhook = smartsheet.WebhookResources.UpdateWebhook(webhook);
hookId = (long)updatedWebhook.Id;
Call back url is help in an AWS secret vault.
Regards
Brian
-
Thank you this is helpful - the POST call I'm making is the equivalent of your CreateWebhook() call.
Interestingly, their documentation states: "Currently, must be an array of size 1 that contains the string value ".", which means "all objects" and "all events"." -- and their example code had:
"events": ["*"]
Both of which are incorrect! I tried your value of
"events": ["*.*"]
and that worked! Thank you!
If the API docs team is reading, please update the docs!
-
Thank you for identifying what needs to be updated in the new API Documentation! I've passed along your feedback to the documentation team.
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 495 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives