简体   繁体   中英

how to chat window to display the selected value after the user clicks the button in the botframework chatbot?

In the python botchat(Webchat),

I want chat Window to display the selected value after the user clicks the button?

And I want to code in this thing in the Client Side , please help me

Also, I want to know about how to use ActionTypes.im_back .

chat window to display the selected value after the user clicks the button.

if str(context.activity.value) != 'None':
 response = context.activity.value  #json ex:{'value':'hello'}
 # if i do,  prompt_message = await 
 create_reply_activity(context.activity, respone.get('value'))
 # bot will say what user typed. but i want to make it from client side like what i could see in
 # contososcubademo.azurewebsites.net
 prompt_message = await create_reply_activity(context.activity, answer)
 gen_result=await oneday_hanlde.Input_generator(response,state.Flow)
 answer= gen_result[0] #text ex: 'hi there!'
 prompt_message = await create_reply_activity(context.activity, answer)

So, I'm assuming you are using Adaptive Cards since you mention buttons. There are a handful of actions you can define for your button and that selection will determine how things are viewed by the bot users and other users, if in a group chat like Teams. You can learn more detail here: Adaptive Card Actions

openUrl: Opens the specified URL in a new browser window. Useful for downloading files or to direct users to other websites. messageBack: Sends a message and payload (Value property), to the bot, and sends a separate message top the chat stream. This is probably what you want to use to show the selected value back to the users in reference to your first ask. imBack: Similar to messageBack except this question and the value displayed will be visible to all user in the conversation invoke: Sends a message and payload to the bot. Nothing is visible to the user signin: Starts the OAuth flow

Please note, not all channels support all Action (even if that channel supports Adaptive Cards)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM