LucasBassetti/react-simple-chatbot

Dynamic step generation

Closed this issue · 0 comments

I have a text file which I want to parse and send each line as a separate message. The way Im currently attempting this is with one step named e2_1 which has a custom component that reads the file, and then sends the line of text to e2_message using triggerNextStep and then e2_message will also use triggerNextStep to call e2_1 in a loop until the end of the file is reached. However right now e2_1 sends an empty message bubble and I want it to send nothing. Is there a way for it to return nothing? I tried using 'replace: true' but when I add 'replace: true' then the value of PreviousStep in e2_message comes back null. How do I handle this? OR approaching the problem another way-- is there a way to generate a new message bubble from the bot for each line of text in the file from the same component?

Steps:

{
            id: 'e2_1',
            component: <Experience2_1 />,
            waitAction: true,
            replace: true,
           },
           {
            id: 'e2_message',
            component: <MessageTemplate />,
            waitAction: true,
            asMessage: true,
           },

Experience2_1:
this.props.triggerNextStep({value: 'some value', trigger: 'e2_message'});