Decoding form submission data sent to webhook - delimiter issue.

  • Profile Image
    genkijacs
    Asked on August 31, 2017 at 07:48 AM

    When using a webhook, when the form is submitted, the form-data contains a field called "pretty" which contains the questions and answers from the jotform.

    The problem is the data is delimited thus:

     

     Question 1 text:Answer 1 text, Question 2 text:Answer 2 text, Question 3 text:Answer 3 text

     

    All well and good until either the question or answer text contains ':' or ', '. Then it is impossible to decode the data since these are not escaped when appearing in the text. So it can end up like:

    Roughly speaking, what is your answer?:I think maybe, I would say perhaps: yes

    and whereas this is one question and answer, using the delimiters prevents it decoding as such!

     

    Decoding the rawRequest data is not really an option since it does not contain the text f the question but instead some sort of field identifier (I guess)

     

    Is it possible to escape the delimiter characters when they appear in a question or answer? Or format the data in some way so that my webhook page can decode the questions and answers from the POST?

     

    Thanks

  • Profile Image
    ashwin_d
    Answered on August 31, 2017 at 10:10 AM

    Hello genkijacs,

    If you meant to say that you want to change the formatting of the output POST data of form, I am very sure that won't be possible but let first we would like to test the issue you are having.

    With which form you are having this issue with? I did check few of your last edited form but couldn't locate any form field "pretty". Is this question a widget or checkbox question? Please let us know the form and we will take a look. 

    Are you also able to capture the raw post data? Is it possible for you to share it with us?

    We will wait for your response.

    Thank you!

  • Profile Image
    liyam
    Answered on September 01, 2017 at 09:08 AM

    It took me some time to figure out what you achievement is being tried. So if I'm not mistaken, you would like the pretty format because it contains the full question, and you want to get that question coming from the form and you do not want to manually create the question and simply match an answer to it.

    Find a pattern

    First matter that we should do here if we need to find a pattern. What are the instances where you get a new question after being separated by a comma? What we have is a colon ':'.

    So what you need to do is pick up the character values after a comma, only if before that there is a matching colon found. If there is an instance of a comma and a comma before it, then it is not a separate question.

    So that's how your algorithm for your script will be in making your elements be your question. Do you have an existing code which you can share that you are using for your webhooks?

    Thanks.

     

  • Profile Image
    Andrew Milford 
    Answered on September 01, 2017 at 12:22 PM

    Ok, consider a question

    "how are you today, are you doing ok, respond yes, if so:no, if not: or maybe?"

    and the answer

    "I  am sort of ok: but could be better, maybe when the sun comes out: or not"

    So this would be encoded in the webhook as

     

    how are you today, are you doing ok, respond yes, if so:no, if not: or maybe?:I  am sort of ok: but could be better, maybe,  when the sun comes out: or not, 

     

    I know this seems a bit contrived and is bad English and punctuation - but an algorithm needs to cope with whatever is thrown at it!

     

    Scanning along the line I think it would decode as:

    Question "how are you today, are you doing ok, respond yes, if so"

    answer "no"

     

    Question "if not"

    answer " or maybe?:I  am sort of ok: but could be better"

     

    Question "maybe, when the sun comes out"

    answer "or not"

    Thanks

  • Profile Image
    Kevin_G
    Answered on September 01, 2017 at 01:33 PM

    May you please try using the WebHooks integration through Zapier, it can be found here: https://zapier.com/zapbook/jotform/webhook/ 

    Please let us know how it goes.