I am not a programmer by any stretch of the imagination. I am trying to create a webhook in Python using Anvil for the callback url
I have created a webhook. I am struggling to get it authenticated/verified. I have spent hours reading and trying all sorts of solutions.
I am using Atom on my desktop for the webhook.
On Anvil, the code I for the callback url is as follows:
@anvil.server.http_endpoint('/webhook', methods=['POST'])
def webhoook(**q):
if 'Smartsheet-Hook-Challenge' in event['headers']:
return {
'statusCode': 200,
'headers': {
'Smartsheet-Hook-Response':
event['headers']['Smartsheet-Hook-Challenge'],
'Content-Type': 'application/json',
'Access-Control-Allow-Methods': 'OPTIONS,GET,POST'
}
}
The code I have for the webhook to enable it is as follows:
Webhook = smartsheet_client.Webhooks.update_webhook(
WEBHOOK_ID_IS_HERE, # webhook_id
smartsheet_client.models.Webhook({
'enabled': True}))
IndexResult = smartsheet_client.Webhooks.list_webhooks(
page_size=100,
page=1,
include_all=False)
print(Webhook)
The response I get back is always disabled.
How do I get my callback url to send the smartsheet header challenge back to smartsheet to enable this webhook?
Additionally, I have code that updates a dropdown list. I currently have this code executing every sixty seconds. Once I get this webhook enabled, how do I listen for this event to execute my code?