Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Echo back #701

Open
b4ldr opened this issue Oct 4, 2024 · 1 comment
Open

Feature: Echo back #701

b4ldr opened this issue Oct 4, 2024 · 1 comment

Comments

@b4ldr
Copy link

b4ldr commented Oct 4, 2024

Hello,

First of all thanks for the great tool :)

I already use webhooks for a few things and so when looking to integrate some smartsheet workflows with a webhook it was the frist tool i reached for. However, there is with the smartsheets there is a verification process which happens when you first register the webhook and then once every 100 callbacks.

This verification process is described as follows:

When an API client attempts to enable a webhook, Smartsheet sends a verification request to the webhook's callbackUrl to verify that the subscriber expects and is able to successfully receive callbacks. The request specifies a unique random value in the Smartsheet-Hook-Challenge header and contains a JSON object in the request body with only challenge and webhookId attributes in the request body. The challenge attribute is a repeat of the header value for API clients that don't interpret header values.

To verify the webhook, the subscriber's response to the verification request must return a 200 HTTP status code and must echo back the same unique random value in the Smartsheet-Hook-Response header of the response or with a JSON smartsheetHookResponse attribute. Once Smartsheet receives this verification response, the webhook is enabled (enabled: true and status: "ENABLED").

From what i can see this is not something that would be currently supported in WebHook, please correct me if im wrong, and wondered, nah hoped you may like to add it as a feature. Unfortunatly i have done very little Go coding and don't think id be compitent enough to work up a PR.

@ianroberts
Copy link
Contributor

Setting response headers to values taken from the request isn't supported, but you should be able to respond

with a JSON smartsheetHookResponse attribute

The key is that "include-command-output-in-response": true allows you to generate the response body in your execute-command by printing to standard output. Your command needs to understand this challenge message and print out the appropriate smartsheetHookResponse JSON, and you'd also need to set "response-headers": [{"name": "Content-Type", "value": "application/json; charset=utf-8"}] to make sure the webhook response is properly declared as JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants