Skip to main content

Sample URL for Webhook Listener

Comments

5 comments

  • Scott Henderson CTO
    Answer Pro
    Top Contributor

    Hey Paul,

    I just created a quick webhook listener, and also tested with Postman.  Please see pics below, and hopefully this helps. 

    P.S. in case it is not obvious, the masked '******' value in the 'Token' field is 'apple', but i changed this already to avoid leaking credentials in clear text.

    integrator.io:

    Postman:

     

    0
  • Paul Siegerist
    Celigo University Level 2: Seasoned
    Engaged

    Scott, thanks for the sample!  Now for a strange problem that I have gotten.  My script all of a sudden is erroring out on a javascript "toString()" function,  Here is the code

    let busdate = options.record.BusinessDate.toString();

    Here is the key/value from the json:
    "BusinessDate": 20220131,

    When I try and "Preview" I get the following error:
    Message: TypeError: Cannot read property 'toString' of undefined
    Location: <anonymous>:20
    Stack: TypeError: Cannot read property 'toString' of undefined
        at transform (<anonymous>:20:43)

    I have been running this transformation script now for weeks with no errors and also use it in this webhook.  When I place the identical json sample in the webhook that is the record brough across from the other integration flow, it produces this error when the other transformation script (the same) runs without a flaw.  This just started occurring today.

     

    0
  • Scott Henderson CTO
    Answer Pro
    Top Contributor

    The only issue I can point out is that the single "record" in your preview input is actually an array, and not a single object, and this is why the script is failing.  It you replace the following, then the script will work.   

    let busdate = options.record.BusinessDate.toString();

    with

    let busdate = options.record[0].BusinessDate.toString();

    That said, you should flush out what format of data (rows/array vs object) is expected here, or maybe the script should be enhanced to support either format, etc...

    0
  • Paul Siegerist
    Celigo University Level 2: Seasoned
    Engaged

    Thanks for the quick reply, Scott.

    Here is the same script run from a different integration/flow - not a webhook.  I am using it for the webhook for real-time record updates, but built the first flow to get all my mappings and transformations down.  It works correctly with one or many records being pulled over.  So I'm not sure why I would be getting javascript errors in a another flow and not the same errors in this flow that works every time...

    0
  • Scott Henderson CTO
    Answer Pro
    Top Contributor

    The quickest way to solve this is gonna be via a support ticket where they can look at both flows and see why the data is in a different format in one vs the other.  Please pass along this specific message to support "in one of my flows the 'record' is an object {} but in my other flow the 'record' is an array []. why are they different?"

    Support will most likely need to see the exact payload you are posting to the webhook listener url.

     

    0

Please sign in to leave a comment.