Search code examples
webhookspodio

Podio webhook verification not received by AWS API Gateway


I have setup API Gateway & Lambda to receive webhooks from Podio. I have setup the webhook in Podio with the API Gateway endpoint and have the lambda function set to log out the received event, just to check it is receiving requests.

The endpoint is currently set to receive any type of request. I originally only set it up to receive POST requests but as it was not receiving anything I opened it up.

Because the API Gateway endpoint works when I test it from other various POST/GET request sites, I set up a test endpoint on an old php server and it received the hook verification from Podio.

Why is either:

  • Podio not sending the hook requests to API gateway?

or

  • API Gateway not receiving posts from Podio?

Solution

  • The resolution came after I discovered how to turn on the CloudWatch logs for API Gateway. I discovered that the data being sent was not JSON formatted as I was expecting, but x-www-form-urlencoded instead. I then setup a mapping template:

    #set( $inputRoot = $input.path('$') )
    #set( $item = {} )
    {
        #foreach( $param in $inputRoot.split('&') )
            #set( $t = $param.split('=') )
            "$t[0]":"$t[1]",
        #end
        "null":"null"
    }
    

    which handles both the hook verification requests but also the webhook posts from Podio, this mapped data then passes successfully into Lambda.

    I use the "null":"null" at the end so I can run the simple foreach loop and still retain valid JSON output