Частичное отключениеshare-external
WhatsApp Flows Text Variable Not Rendering in Template String
1

I'm working with WhatsApp Flows and trying to display the total cost based on user input in a form. I have a TextInput field for the quantity, and below that, I'm trying to display a message that calculates the total cost based on the quantity entered by the user and a fixed price (in this case, 100).

Here's my code:

{ "version": "5.0", "screens": [ { "data": { "value": { "type": "boolean", "example": true } }, "id": "SCREEN", "layout": { "type": "SingleColumnLayout", "children": [ { "type": "TextInput", "label": "Quantity", "name": "number" }, { "type": "TextHeading", "text": "the total cost is ${form.number * 100}" }, { "type": "Footer", "label": "Complete", "on-click-action": { "name": "complete", "payload": {} } } ] }, "title": "Welcome", "terminal": true, "success": true } ] } However, instead of calculating and displaying the total cost, it's printing the string literally as:

the total cost is ${form.number * 100}

I want it to evaluate the expression and show the actual calculation based on the user's input, but I'm not sure how to get this working correctly.

I tried different ways of escaping the expression, but none seem to work. I looked into documentation, but I couldn't find a solution specific to WhatsApp Flows.

How can I dynamically render the calculated total cost based on user input in WhatsApp Flows? How do I make sure the expression gets evaluated and the result is displayed?

Omar
Вопрос задан около 2 мес. назад
Выбранный ответ
2

Hi Omar, nested expressions i.e. dynamic data in the format ${data.var} or ${form.var}, in combination with static text is not yet supported.

Please keep following our change logs (https://developers.facebook.com/docs/whatsapp/flows/changelogs) for further updates on this feature!

2 октября в 11:17
Vasudha