cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TomaszChmiel
Frequent Visitor

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

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
Frequent Visitor

Bump

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.

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

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

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

Sunay
Power Automate
Power Automate

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

Anonymous
Not applicable

 

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

 

Thanks

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
New Member

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.

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

Anonymous
Not applicable

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

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (53,314)