[Power Automate – Teams] Trying to resolve the error “The payload is too large” when posting an adaptive card to MS Teams

I recently had the opportunity to work on a project where I needed to send an adaptive card to a Teams chat using Power Automate. After spending a few hours on building the adaptive card I was convinced that I had finished the job and that I just needed to use Power Automate to send the card to a Teams chat. Unfortunately, Cloud Flow did not save by returning the following error:

Request to XRM API failed with error: 'Message: Flow client error returned with status code "BadRequest" and details "{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'DynamicOperationRequestClientFailure' and message 'The dynamic operation request to API 'teams' operation 'GetFlowContinuationSubscriptionWithPosterOutputMetadata' failed with status code 'RequestEntityTooLarge'. This may indicate invalid input parameters. Error response: {\"error\": \"The payload is too large. Please make sure the size is less than 28KB.\"}'."}}".

To give you some context, the JSON definition of the adaptive card contains 820 lines. Indeed, the card implements a Multi Step Form (Wizard Form) according to some Business rules. If you want to implement this kind of adaptive card do not hesitate to leave a comment, I will think of sharing an example in a future blog 🙂

To know the size of the JSON that defines my Adaptive Card, I use an online tool. This one returns 35 KB which is far beyond the size limit supported by the Teams connector.

Still using the same tool and clicking on the “Ignore whitespace” option, the JSON size changes to 11.55 KB. Fortunately for me, this size is supported by the Teams connector!

After removing whitespace using this online tool. My Power Automate is saved without any problem, and the adaptive card is sent to the user via a Teams chat.

To summarize, we have a limitation in the size of the adaptive cards that Power Automate sends to Teams. Indeed, the JSON definition cannot exceed 28KB. Remember to remove spaces and empty lines and analyze the size of the JSON again and hope that you do not exceed the size limit.

That’s all for this blog, hope it will be useful for you one day.


One thought on “[Power Automate – Teams] Trying to resolve the error “The payload is too large” when posting an adaptive card to MS Teams

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s