Skip to main content

Verify Webhook

Overview

The Verify Webhook Traffic Policy action enables you to validate incoming webhook signatures against a known secret to ensure authenticity, and either forwards the request to the next action or rejects it based on the verification result.

Configuration Reference

This is the Traffic Policy configuration reference for this action.

Action Type

verify-webhook

Configuration Fields

ParameterTypeDescription
providerstringRequired. The name of the provider to verify webhook requests from. Value must be one of the supported providers.
secretstringA secret key used to validate requests from the given provider.
enforceboolWhether or not the actions is executed (defaults to true)`.

Supported Directions

  • on-http-request

Supported Schemes

  • https
  • http

Behavior

The verify-webhook action validates that incoming webhook requests are authentic. When a request is received, the action verifies the request by validating its signature against a known secret. If the verification is successful, the action allows the request to continue through the action chain and to finally to your application; if verification fails, the request will be terminated with a 403 Forbidden response.

Verification Process

  • Signature Validation: The action validates incoming webhook signature to confirm the request originates from the configured provider and that the payload has not been tampered with.
  • Request Handling: If the webhook verification is successful, the request is forwarded to the next action. If the verification fails, the request chain is terminated with a 403 response.
  • Configurable Enforcement: By default, verification failures result in termination. However, setting enforce: false allows unverified requests to proceed, while logging the verification result. This option is for debugging and testing.

Endpoint Verification

Some webhook providers require an initial endpoint verification challenge to validate that your application is legitimate before sending webhook events. The verify-webhook action automatically handles endpoint verification challenges for supported providers.

  • Supported providers:
    • Twitter
    • Worldline
    • Xero
    • Zoom

Replay Prevention with Timestamp Tolerance

To prevent replay attacks, ngrok verifies that the webhook’s timestamp falls within an acceptable range.

Secret Handling and Encryption

All secrets used for webhook verification are encrypted at config validation. When ngrok processes a requests the secret is decrypted.

Supported Providers

ProviderProvider IdentifierIntegration Guide
AfterShipaftershipDocumentation
AirshipairshipDocumentation
AlchemyalchemyDocumentation
Amazon SNSsnsDocumentation
Autodesk Platform ServicesautodeskDocumentation
BitbucketbitbucketDocumentation
BoltboltDocumentation
BoxboxDocumentation
BrexbrexDocumentation
BuildkitebuildkiteDocumentation
CalendlycalendlyDocumentation
CastlecastleDocumentation
ChargifychargifyDocumentation
CircleCIcircleciDocumentation
ClearbitclearbitDocumentation
ClerkclerkDocumentation
CoinbasecoinbaseDocumentation
ContentfulcontentfulDocumentation
DocuSigndocusignDocumentation
DropboxdropboxDocumentation
Facebook Graph APIfacebook_graph_apiDocumentation
Facebook Messengerfacebook_messengerDocumentation
Frame.ioframeioDocumentation
GitHubgithubDocumentation
GitLabgitlabDocumentation
Go1go1Documentation
HerokuherokuDocumentation
Hosted HookshostedhooksDocumentation
HubsSpothubspotDocumentation
Hygraph (Formerly GraphCMS)graphcmsDocumentation
InstagraminstagramDocumentation
IntercomintercomDocumentation
Launch Darklylaunch_darklyDocumentation
MailchimpmailchimpDocumentation
MailgunmailgunDocumentation
Microsoft Teamsmicrosoft_teamsDocumentation
Modern Treasurymodern_treasuryDocumentation
MongoDBmongodbDocumentation
MuxmuxDocumentation
OrborbDocumentation
OrbitorbitDocumentation
PagerDutypagerdutyDocumentation
PinwheelpinwheelDocumentation
PlivoplivoDocumentation
PusherpusherDocumentation
SendGridsendgridDocumentation
SentrysentryDocumentation
ShopifyshopifyDocumentation
Signal Sciencessignal_sciencesDocumentation
SlackslackDocumentation
Sonatype NexussonatypeDocumentation
SquaresquareDocumentation
StripestripeDocumentation
SvixsvixDocumentation
TerraformterraformDocumentation
TikToktiktokDocumentation
Trend Micro Conformitytrendmicro_conformityDocumentation
TwiliotwilioDocumentation
TwittertwitterDocumentation
TypeformtypeformDocumentation
VMware WorkspacevmwareDocumentation
WebexwebexDocumentation
WhatsAppwhatsappDocumentation
WorldlineworldlineDocumentation
XeroxeroDocumentation
ZendeskzendeskDocumentation
ZoomzoomDocumentation

Examples

Basic Example

This example configuration sets up an endpoint (gitlab-webhook-example.ngrok.io) that receives webhook requests from GitLab. The Verify Webhook action checks if the request is authentic based on a shared secret. If verified, a custom response is sent back with a 200 status and a plain text confirmation message.

Example Traffic Policy Document

---
inbound:
- actions:
- type: "verify-webhook"
config:
provider: "gitlab"
secret: "secret!"
- type: "custom-response"
config:
status_code: 200
headers:
content-type: "text/plain"
content: "GitLab webhook verified"

Start Endpoint with Traffic Policy

ngrok http 8080 --url gitlab-webhook-example.ngrok.io --traffic-policy-file /path/to/policy.yml
$ curl --location --request POST 'https://gitlab-webhook-example.ngrok.io/' \
--header 'X-Gitlab-Token: secret!'
agent webhooks pog%
...
> POST / HTTP/2
> Host: gitlab-webhook-example.ngrok.io
> User-Agent: curl/[version]
> Accept: */*
> X-Gitlab-Token: secret!
...

This request will first be processed by the Verify Webhook action. If the GitLab webhook verification is successful, ngrok will return a 200 OK response with the message GitLab webhook verified.

HTTP/2 200 OK
content-type: text/plain
GitLab webhook verified

Action Result Variables

The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.

NameTypeDescription
actions.ngrok.verify_webhook.verifiedboolWas the request verified or not?
actions.ngrok.verify_webhook.error.codestringCode for an error that occurred during the invocation of an action.
actions.ngrok.verify_webhook.error.messagestringMessage for an error that occurred during the invocation of an action.