Announcement

Collapse
No announcement yet.

Workflow Webhooks and custom module

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

    Workflow Webhooks and custom module

    I am not sure if this makes sense or is there another better/structured way to this. Also, I am just beginning to get up to speed on Workflows and not sure how to take advantage.

    I have a custom module that needs to run a function for shipping type tasks. I only need the order number passed to my module's function. Timing is important with some prerequisite tasks. When figuring this out with the client, running in Workflows will probably be best if we can do it. I am wondering if triggering a webhook would be possible? The webhook URL would be the current Miva store. I understand that the payload would be the Order JSON object. It would have all I needed to run my module's function.

    Can the Workflow Webhook URL call the current domain name?

    When this happens, my plan is to intercept the call with a system function where If the Screen = MyCallBackScreen, process the s.content_data passed from Order Workflows to extract the Order_ID and run the module function.

    Any suggestions?

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    #2
    Yes, Order Workflows supports webhooks. I would probablyhave your module implement the json feature and call the JSON function directly instead of intercepting a screen. Besides that, everything you mentioned should work.
    David Carver
    Miva, Inc. | Software Developer

    Comment


      #3
      Thanks David.

      I am also just starting to get up to speed on the JSON Features too.
      How and where would I implement the JSON function and which function? And the critical part for timing, how does that JSON function get triggered from Order Workflows?
      Does Workflows have a function that will cycle through all the JSON featured modules and run a specific function in my module? The only analogy I can think of is how Fulfillment modules are cycled.

      Scott
      IDS
      Need to offer Shipping Insurance?
      Interactive Design Solutions https://www.myids.net
      MivaMerchant Business Partner | Certified MivaMerchant Web Developer
      Competitive Rates, Custom Modules and Integrations, Store Integration
      AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
      My T-shirt Collection is mostly MivaCon T-shirts!!

      Comment


        #4
        You would need to implement the Module_JSON function. See the API guide at https://www.miva.com/apiguide.

        And no, you would configure Order Workflows to do a web hook to your module. The URL would be something like <your site>/mm5/json.mvc?Session_Type=runtime&Function=Module&Modu le_Code=<your module code>&Module_Function=<your function name>

        You should also use Order Workflow to configure a basic authentication method. Then when you configure the webhook URL you would select authentication you created. Then inside your Module_JSON function would should verify the basic authentication username / password match. If so, you would process the data, otherwise you should reject the request.
        Last edited by dcarver; 02-03-23, 08:34 AM.
        David Carver
        Miva, Inc. | Software Developer

        Comment


          #5
          Thank You, David.

          I think this might be the last question, Is the payload from Order Workflows passed to the web hook URL automatically available to the function in my module? The JSON object would be in s.content_data? Is there another variable to parse/process?

          Scott
          Need to offer Shipping Insurance?
          Interactive Design Solutions https://www.myids.net
          MivaMerchant Business Partner | Certified MivaMerchant Web Developer
          Competitive Rates, Custom Modules and Integrations, Store Integration
          AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
          My T-shirt Collection is mostly MivaCon T-shirts!!

          Comment


            #6
            You should be able to access it it via s.json_data where it will already exist as a structure.
            David Carver
            Miva, Inc. | Software Developer

            Comment


              #7
              Thank you again.

              Scott
              Need to offer Shipping Insurance?
              Interactive Design Solutions https://www.myids.net
              MivaMerchant Business Partner | Certified MivaMerchant Web Developer
              Competitive Rates, Custom Modules and Integrations, Store Integration
              AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
              My T-shirt Collection is mostly MivaCon T-shirts!!

              Comment

              Working...
              X