cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomaszChmiel
Level: Powered On

Custom API WebHook Trigger - dynamic WebHook response schema

Hello!

 

I have created my Custom API Trigger which uses WebHooks. I have added "x-ms-dynamic-schema" to one parameter in my Trigger which allows me to dynamically select options provided by my api.

My subscribe endpoint in swagger looks like this:

 

"/api/external/WebHook/Subscribe": {
      "x-ms-notification-content": {
        "description": "Details for Webhook",
        "schema": {
          "type": "object",
          "properties": {
            "FormSubmittedData": {
              "type": "string"
            },
            "User": {
              "type": "object",
              "properties": {
                "UserName": {
                  "type": "string"
                },
                "UserEmail": {
                  "type": "string"
                }
              }
            },
            "SubmitDate": {
              "type": "string"
            },
            "DisplayDataUrl": {
              "type": "string"
            },
            "FormTitle": {
              "type": "string"
            }
          }
        }
      },
      "post": {
        "tags": [
          "WebHook"
        ],
        "summary": "When form is submitted",
        "operationId": "webhook-trigger",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "201": {
            "description": "Created"
          }
        },
        "parameters": [
          {
            "name": "Request body of webhook",
            "in": "body",
            "description": "This is the request body of the Webhook",
            "schema": {
              "type": "object",
              "properties": {
                "TriggerUrl": {
                  "type": "string",
                  "x-ms-visibility": "internal",
                  "x-ms-notification-url": true
                },
                "FormUid": {
                  "type": "string",
                  "x-ms-summary": "Select form",
                  "x-ms-dynamic-values": {
                    "operationId": "GetFormSchemas",
                    "parameters": {},
                    "value-collection": "values",
                    "value-path": "Uid",
                    "value-title": "Title"
                  }
                }
              }
            }
          }
        ],
        "x-ms-trigger": "single"
      }
    }

 

 

So here comes my question, can I make "schema" property of "x-ms-notification-content" dynamic? I would like to use selected FormUid to get webhook response schema and use it in "x-ms-notification-content" property as schema.

 

To be honest i want it to work like Typeform trigger does, first you select form which triggers flow and then you can use all field of this form as dynamic values in next action or trigger.

Is it posibble?

 

I can provide more details if needed

1 ACCEPTED SOLUTION

Accepted Solutions
TomaszChmiel
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hello

 

I managed to solve my problem by myself. Also i have found a strange bug which occurrs in Typeform trigger too.

I have created two forms in Typeform adn after selecting both of them in trigger dropdown all field from both forms appeared in dynamic content in my action.

flow_bug.png

 

Seems like all Json schemas are morged/mixed after fetching from endpoint. I tried to fix that in my trigger but didn't manage to do it so far.

If you want more feedback about flow or more detailed information about this problem just contact me or reply here.

 

Regards

View solution in original post

11 REPLIES 11
TomaszChmiel
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Bump

Community Support Team
Community Support Team

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hi @TomaszChmiel,

 

Have you checked the article below?

Customize your Swagger definition for Microsoft Flow

Would "x-ms-dynamic-schema " help here?

For more details, please check the article above.

Regards

 

Community Support Team _ Michael Shao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
TomaszChmiel
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hi, thanks for your response.

 

Yes Itried it like this:

  "x-ms-notification-content": {
    "description": "Details for Webhook",
    "x-ms-dynamic-schema": {
      "operationId": "GetSchema",
      "value-path": "schema"
    }
  }

And like this:

"x-ms-notification-content": {
    "description": "Details for Webhook",
    "schema": {
      "x-ms-dynamic-schema": {
        "operationId": "GetSchema",
        "value-path": "schema"
      }
    }
  }

In both cases Flow didn't send any request to GetSchema endpoint.

In my opinion both examples are wrong because docuemtntation says "This is a hint to the flow designer that the schema for this parameter (or response) is dynamic in nature.".

So maybe it should be included in response/parameters attributes? But i dont' really know where should I put this.

Regards

TomaszChmiel
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hello

 

I managed to solve my problem by myself. Also i have found a strange bug which occurrs in Typeform trigger too.

I have created two forms in Typeform adn after selecting both of them in trigger dropdown all field from both forms appeared in dynamic content in my action.

flow_bug.png

 

Seems like all Json schemas are morged/mixed after fetching from endpoint. I tried to fix that in my trigger but didn't manage to do it so far.

If you want more feedback about flow or more detailed information about this problem just contact me or reply here.

 

Regards

View solution in original post

Power Automate Staff Sunay
Power Automate Staff

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hi @TomaszChmiel -

 

I am working on posting a tutorial to help with this issue. I will update the thread as soon as the tutorial is live.

 

Thanks,

Sunay

Power Automate Staff Sunay
Power Automate Staff

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hello @TomaszChmiel - The docs have been updated here : https://flow.microsoft.com/en-us/documentation/customapi-how-to-swagger/

The doc links to a swagger that actually works so you can test the functionality in real time.

 

Thanks,

Sunay

kd1989
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

 

Could you please help me with how you were able to create a custom API webhook trigger for flow? 

 

Thanks

pbijvani
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

I am also facing similar issue. Can not make x-ms-dynamic-schema work with trigger. FLOW is not calling my schema endpoint.

can you share your swagger here? 

MartinHutch
Level: Power Up

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hi, 

Hopefully someone can help with this related question.

I can succesfully create and delete the webhook request.

However i dont seem to be able to find where to find how to reference the Microsoft Flow "system" to recieve the api feed which is one of the parameters when creating the webhook.

 

Any help greatly appreciated.

wuweng
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

This is a sample custom connector with Webhook trigger. Hope it can help.

Ddaughtrey
Level: Powered On

Re: Custom API WebHook Trigger - dynamic WebHook response schema

Hello! I am trying to achieve what you have done. Any possible way you could help guide me through it?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (5,737)