Intended Functionality
I have created a skill which is meant to allow a user to start a conversation with a live person. In order to accomplish this they are shown a prompt with 1 choice: "Connect". When they click "Connect" the skill moves to the next waterfall step which executes code to initiate the live person conversation. The problem I am running into is that if they do not hit "Connect" & instead type something else then whatever response they get is followed by the same "Connect" prompt. This is a normal situation which could occur. They may not want to talk to a live person, they may want to continue talking to the bot.
The "Connect" button is really just meant to execute the code to start the conversation. I don't know of any other way to do this other than putting it in a waterfall dialog & having the next step be the code I want execute.
Reproducing
I have created a similar example in this repo: LoopingPrompt Repo
In my repo there is a bot called "ComposerMultiSkillDialog"
It contains a few skills & a few intents.
Running the project
In order to run this project you need Visual Studio & the Bot Composer
Open the solution file: MultiSkillComposerBot.sln
Ensure that Bot.Skills is the startup project.
Hit F5 to run the project. It should start on port 36352.
Then open the Bot Composer to the folder: ComposerMultiSkillDialog
Start the Bot then use "Open Web Chat"
Type "loop" to see the prompt with the choice "Handle Prompt"
Then type "call skill 1" to cause an interruption.
Notice that after "call skill 1" completes the prompt with "Handle Prompt" appears again.
This will continue to happen as the user says more things until they click the "Handle Prompt" button.
Goal
The goal is to prevent this behavior & only have the "Handle Prompt" appear the first time. If there is an interruption then it would not appear again.
Attempts To Resolve
What I have tried so far is:
Find a way to add a "Max Turn Count" which is an available option within the Bot Composer. This is not an available option within stepContext.PromptAsync though as far as I can tell

I debugged through the code when the 2nd "Handle Prompt" appears. The code goes through the controller, into the constructor of LoopingPromptDialog & into the AddAdditionalDialogs method. I was hoping that it would get into PromptStepAsync where I could put a counter of some kind to detect if this had already been reached & stop it but PromptStepAsync is never called. I'm not exactly sure how the "Handle Prompt" is actually being sent back to the chat again.
I would not be able to have the code which is called after "Handle Prompt" be its own intent. I would not want to start a chat with a live person right away if the user typed something which triggered that intent. So cannot have a "Connect" intent which starts the chat with a live person.
I tried to check if an action can be linked to a hero card response somehow which would execute the code but have not been able to find anything like that.
Any help is appreciated! Thank you for your time.


