-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin-flow-builder: bot action as follow up, first node in a flow, after conditionals etc #2898
Merged
Iru89
merged 16 commits into
master-lts
from
plugin-flow-builder/bot-action-as-follow-up
Oct 1, 2024
Merged
plugin-flow-builder: bot action as follow up, first node in a flow, after conditionals etc #2898
Iru89
merged 16 commits into
master-lts
from
plugin-flow-builder/bot-action-as-follow-up
Oct 1, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Iru89
requested review from
vanbasten17,
asastre,
AinaVendrell,
ericmarcos and
MarcosCA
and removed request for
vanbasten17 and
asastre
September 4, 2024 08:42
Iru89
commented
Sep 4, 2024
packages/botonic-plugin-flow-builder/src/content-fields/flow-bot-action.tsx
Outdated
Show resolved
Hide resolved
ericmarcos
requested changes
Sep 5, 2024
vanbasten17
approved these changes
Sep 5, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add at least a test for this new scenario 🙏
ericmarcos
approved these changes
Sep 5, 2024
…e it as a content
…on starts with flow_builder_bot_action:
…arameter the contentID to indicate which content has to be rendered
…nicAction and rename to redirect
…enum with all BotonicAction and use it in tests
…number of redirects has been exceeded
…nteractionContents do not render the match with keywords, intents etc
Iru89
force-pushed
the
plugin-flow-builder/bot-action-as-follow-up
branch
from
October 1, 2024 15:58
d4eb071
to
aa03d62
Compare
Test Results30 tests 26 ✅ 35s ⏱️ For more details on these failures, see this check. Results for commit aa03d62. ♻️ This comment has been updated with latest results. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Be able to use bot-action nodes at any point in the flow builder. For example as follow ups, after a conditional, at the start of a flow etc
The request.input should be immutable. To avoid modifying the request.input in the lambda execution, FlowBuilderAction.botonicInit function accepts as a second parameter the contentID to indicate which content has to be rendered. This contentID is the unique text that is defined in the flow builder frontend. This way you don't need to get the UUID of the content and modify the request.input.payload to indicate to the plugin which content to render.
Context
Bot-action nodes could only be used connected to a button or after a handoff.
With this solution it will be possible to make flow in a simpler way. There are several use cases in which the flow is greatly simplified by being able to put bot actions after a conditional or at the beginning of a flow.
Flow example:
Approach taken / Explain the design
The third commit makes the core bot run again (prePlugins, routes, render, postPlugins). I think this should be the backend in charge of re-executing the lambda of the bot to avoid timeouts if the actions are asynchronous and more than one is chained. This way we would also avoid modifying the request.input.payload in a lambda execution.
IMPORTANT
With this change in the custom actions written in the flow it is necessary to obtain the following contents using the function FlowBuilderAction.botonicInit(request) since this is the one in charge of putting the variable in the session so that if there is another bot action connected to the flow, the bot will continue executing.
To document / Usage example
WelcomeAction example
Testing
For now I have not checked the tests, I am aware that they are failing.