Announcement

Collapse
No announcement yet.

request body - webhook

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    request body - webhook

    I am working on an integration with a third party company.
    They are sending Webhooks to pages I create.
    The only thing I know is they are sending json in the body.

    How do I grab what they send so I can pare it and deal with it?

    I was looking at javascript response.body but have not gotten anywhere.

    Any suggestions, ideas?

    Bill
    William Gilligan - Orange Marmalade, Inc.
    www.OrangeMarmaladeinc.com

    #2
    Re: request body - webhook

    We did a Paywhirl integration for an animal rescue charity. While we used PHP they also had the basics for dealing with Webhooks via NODE.js

    http://support.paywhirl.com/support/...ssing-webhooks

    Notice each snippet is addressing request.body vs response.body since each Webhook is a treated as a request.

    There is actually a need to generate a response.

    "Remember, with Webhooks, your server is the server receiving the request. Webhook data is sent as JSON in the request's body."

    Hope this helps at least an iota or two.

    Comment


      #3
      Re: request body - webhook

      Originally posted by nottheusual1 View Post
      We did a Paywhirl integration for an animal rescue charity. While we used PHP they also had the basics for dealing with Webhooks via NODE.js
      Thanks for the info.
      I am trying to do as much as possible strictly in Miva Script - however the node.js may be an answer and I will dig into it further!
      Thanks,
      Billl
      William Gilligan - Orange Marmalade, Inc.
      www.OrangeMarmaladeinc.com

      Comment


        #4
        Re: request body - webhook

        In version 5.18 or higher of Empresa there is a variable that may contain the request body. It is named s.content_data

        The reason I say "may" is because this is only set if the Content-Type is not "application/x-www-form-urlencoded" or "multipart/form-data"

        So this may work for you depending on what Content-Type is being set with the web hook request.
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          Re: request body - webhook

          Originally posted by Brennan View Post
          In version 5.18 or higher of Empresa there is a variable that may contain the request body. It is named s.content_data

          The reason I say "may" is because this is only set if the Content-Type is not "application/x-www-form-urlencoded" or "multipart/form-data"

          So this may work for you depending on what Content-Type is being set with the web hook request.
          Hi Brennan,
          Just an update - this was EXACTLY what I needed.
          Thank you.
          Bill
          William Gilligan - Orange Marmalade, Inc.
          www.OrangeMarmaladeinc.com

          Comment


            #6
            What if it is application/x-www-form-urlencoded?
            William Gilligan - Orange Marmalade, Inc.
            www.OrangeMarmaladeinc.com

            Comment


              #7
              That just means all the data now exists in global variables. application/x-www-form-urlencoded just means data was passed to the server as "First_Name=Bob&Last_Name=Barker" and now g.First_Name and g.Last_Name variables exist.
              David Carver
              Miva, Inc. | Software Developer

              Comment


                #8
                How does the s.content_data translate to processing a webhook in a NodeJS environment? I created an Order Workflow in a Miva 10.01 store that sends a webhook whenever an order is created. The webhook fires as expected and I receive a request at my endpoint. The query parameter is populated with the Order ID but the request body is empty and the order data is nowhere to be found. What am I missing?

                Comment


                  #9
                  So, with the help of Miva Support I figured out what was lacking and am now answering my own post. Miva Store Admin offers two configurable webhooks, one utilizing GET and one POST for the requests in response to an Order being created. The GET webhook apparently (I could not find this in any documentation) only fires a webhook with the Order ID as a query parameter with no request body. Very limited use in my opinion. However the POST webhook provides all documented fields in the request body without any query parameters. This is what I was looking for.

                  Comment

                  Working...
                  X