Developing webhooks using ngrok

I was wondering if anybody had any luck working with webhooks locally using ngrok. I am able to step through my code in Visual Studio if I call my endpoints using Postman (via ngrok) but as soon as I attempt to subscribe to a webhook I get the following:

 
"We were unable to reach the specified webhook URL. Please check the URL and try again.",


​In ngrok the call is shown but with a 307 Temporary Redirect:

OPTIONS /eventhandler          307 Temporary Redirect 

This is what happens when I run it using IIS Express in Visual Studio. When I run it using the app's own container I do not get a temporary redirect but get the following result:

 
Received an invalid HTTPS status code from your webhook URL when performing the CloudEvent's Abuse Protection handshake with your webhook URL. Review our Webhook API documentation to learn more. https://developer.blackbaud.com/skyapi/apis/webhook,


Thanks in advance.

Comments

  • Ben Wong
    Ben Wong Blackbaud Employee
    Tenth Anniversary Kudos 3 Name Dropper Participant
    Hey David, I know our internal devs at Blackbaud have used Ngrok successfully for testing webhooks but I don't know what the specific scenario is that could be giving you that error message.
  • So I only get the 307 redirect when I use IIS Express. When I use .NET core's own self-contained server I don't get any message but Blackbaud returns the invalid HTTPS status code message. However it never reaches the code as far as I can see...
  • @Ben Wong So I am picking this up again (after a number of years!) I thought that I had gotten it to work previously but apparently not. When I try and do the same thing as I described back in 2020 I get the same errors.

    In my ngrok config I define it as follows:


    authtoken: <my authtoken>
    tunnels:
    orgStack:
    proto: http
    hostname: myngrokinstance.ngrok.io
    addr: localhost:5000
    # -------------------------
    # Additional options
    # -------------------------
    host_header: "localhost:5000"

    When I send through a subscribe I see that ngrok has received a call:

    OPTIONS /api/tracker/eventhandler 307 Temporary Redirect

    but I get the following back from Blackbaud:

    {
    "type": "urn:blackbaud:webhook-url-unreachable", "title": "One or more validation errors occurred.",
    "status": 400, "detail": "We were unable to reach the specified webhook URL. Please check the URL and try again.",
    "trace_id": "0290eb3094614c699d09509044bf8faf",
    "span_id": "82bd80723460bada"
    }

    If I call the same url using the OPTIONS method it does go into my VS2022 code.

    Anybody get this to work?

  • I managed to fix this by changing the addr entry in the yaml file to

    https://localhost:5001

    That way there is no redirect going on when calling my https:myngrokinstance.ngrok.com

  • Ben Wong
    Ben Wong Blackbaud Employee
    Tenth Anniversary Kudos 3 Name Dropper Participant

    @David Zeidman I had faith that Captain Webhook would find a way!

Categories