Code Monkey home page Code Monkey logo

Comments (7)

adnanh avatar adnanh commented on May 2, 2024

Thanks for the write up! I'll take a look into this as soon as possible and will post you with an update and a solution... :-)

The thing with the form-encoded payload in webhook at the moment is that you can only get values of the passed variables, in your case being payload variable with the JSON payload. So basically you can pass that JSON string to your script and then parse it inside and extract the values you are interested in.

I will see what modifications can I incorporate into webhook to make it easier for this scenario...

from webhook.

adnanh avatar adnanh commented on May 2, 2024

I'm thinking about adding a property on the hook named json-parameters which would contain a list of parameters that the user expects to contain JSON strings. Upon receiving the request, webhook would then try to parse those values as JSON and the user could use them just like the parameters in JSON formatted payload. (parameter.key.anotherkey). Solving the issue you currently have... What do you think?

from webhook.

moorereason avatar moorereason commented on May 2, 2024

So as an example, I could define "json-parameters": [ "mypayload" ] in hooks.json, and webhook would decode the mypayload form variable as JSON. Then I would reference the JSON items like this:

{
  "match": {
    "type": "value",
    "parameters": {
      "source": "payload",
      "name": "mypayload.commits.0.branch"
    },
    "value": "needle"
  }
}

I like the idea.

However, json-parameters sounds a little ambiguous to me. It might confuse people into thinking it has something to do with the match.parameter triggers from the hook package. What about http-json-parameters? But either way, you make the call. It'll be great. 😄

from webhook.

adnanh avatar adnanh commented on May 2, 2024

Exactly that. Maybe parse-parameters-value-as-json? :-)

from webhook.

adnanh avatar adnanh commented on May 2, 2024

I'll get this done tonight.

from webhook.

moorereason avatar moorereason commented on May 2, 2024

Success!!

from webhook.

adnanh avatar adnanh commented on May 2, 2024

Awesome! :-)

from webhook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.