Forum Discussion
aymiee
Jan 19, 2024Brass Contributor
Inconsistent Display of Array Property in Bot Framework Composer
Not sure if this is the right space for this. I have a Teams Bot built with the Bot Framework Composer and recently noticed the following behavior change. I grab the user's response via = turn....
- Jan 22, 2024
aymiee - The behavior change you are experiencing is due to an update in the template engine used by the Bot Framework Composer. The new output format treats
user.inputData
as an object with propertieslgType
andtext
, wheretext
holds your array.
Prasad_Das-MSFT
Microsoft
Jan 22, 2024aymiee - The behavior change you are experiencing is due to an update in the template engine used by the Bot Framework Composer. The new output format treats user.inputData
as an object with properties lgType
and text
, where text
holds your array.
- aymieeJan 22, 2024Brass Contributor
Thank you -- I have made the changes on my backend but now the Bot Framework is throwing errors. My web app use to return the response in a 'message' field and I retrieve it in the Bot Framework as so: ${turn.results.content.data.message}
Recently, I started getting "Operation returned an invalid status code 'BadRequest'". The structure of ${turn.results} has changed to:
{ "lgType": "Activity", "text": { "statusCode": 200, "reasonPhrase": "OK", "headers": { "Date": "Mon, 22 Jan 2024 04:58:15 GMT", "Server": "gunicorn" }, "content": { "data": "How can I assist you today? If you have any IT-related queries, need information from the company data, or have compliance-related questions, feel free to ask!" } } }
Attempts to access the data with ${getProperty(turn.results.text.content, 'data')} have been unsuccessful resulting in Operation returned an invalid status code 'BadRequest'
Additionally, ${turn.results.text}, ${turn.results.text.content}, ${turn.results.text.content.data} and are returning empty. How should I obtain 'data' value from the JSON structure in Bot Framework Composer? The standard methods for access the data are not working. Please advise.
EDIT --FIXED -- I modified my Flask app to not encapsulate the response in a JSON object with 'data' as the key since the Bot Framework Composer already uses 'content' and 'data' keys in its JSON structure. I can now access value via ${turn.results.content}