diff --git a/apps/docs/editor/events/on-message.mdx b/apps/docs/editor/events/on-message.mdx deleted file mode 100644 index d49fb6b3b..000000000 --- a/apps/docs/editor/events/on-message.mdx +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: On New Message ---- - -This event allows you to define a message that will trigger a specific flow when sent. - -You can optionally resume the flow. - - - On New Message event in Typebot editor - \ No newline at end of file diff --git a/apps/docs/editor/events/reply.mdx b/apps/docs/editor/events/reply.mdx new file mode 100644 index 000000000..01f3a672a --- /dev/null +++ b/apps/docs/editor/events/reply.mdx @@ -0,0 +1,11 @@ +--- +title: Reply Event +--- + +This event will trigger everytime a reply is received. + +Enable and define an **Exit condition** to exit the main flow and start the Reply Event block flow. + + + On New Message event in Typebot editor + \ No newline at end of file diff --git a/apps/docs/images/events/on-message.avif b/apps/docs/images/events/on-message.avif deleted file mode 100644 index 351152a81..000000000 Binary files a/apps/docs/images/events/on-message.avif and /dev/null differ diff --git a/apps/docs/images/events/reply-event.avif b/apps/docs/images/events/reply-event.avif new file mode 100644 index 000000000..15b2c400b Binary files /dev/null and b/apps/docs/images/events/reply-event.avif differ diff --git a/apps/docs/openapi/builder.json b/apps/docs/openapi/builder.json index f33242f88..3b60086e7 100644 --- a/apps/docs/openapi/builder.json +++ b/apps/docs/openapi/builder.json @@ -3303,17 +3303,73 @@ "type": { "type": "string", "enum": [ - "onMessage" + "reply" ] }, "options": { "type": "object", "properties": { - "message": { + "variableId": { "type": "string" }, - "resumeAfter": { - "type": "boolean" + "exitCondition": { + "type": "object", + "properties": { + "isEnabled": { + "type": "boolean" + }, + "condition": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Greater or equal to", + "Less than", + "Less or equal to", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + } } } } @@ -4014,17 +4070,73 @@ "type": { "type": "string", "enum": [ - "onMessage" + "reply" ] }, "options": { "type": "object", "properties": { - "message": { + "variableId": { "type": "string" }, - "resumeAfter": { - "type": "boolean" + "exitCondition": { + "type": "object", + "properties": { + "isEnabled": { + "type": "boolean" + }, + "condition": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Greater or equal to", + "Less than", + "Less or equal to", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + } } } } @@ -6773,17 +6885,73 @@ "type": { "type": "string", "enum": [ - "onMessage" + "reply" ] }, "options": { "type": "object", "properties": { - "message": { + "variableId": { "type": "string" }, - "resumeAfter": { - "type": "boolean" + "exitCondition": { + "type": "object", + "properties": { + "isEnabled": { + "type": "boolean" + }, + "condition": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Greater or equal to", + "Less than", + "Less or equal to", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + } } } } @@ -23064,17 +23232,73 @@ "type": { "type": "string", "enum": [ - "onMessage" + "reply" ] }, "options": { "type": "object", "properties": { - "message": { + "variableId": { "type": "string" }, - "resumeAfter": { - "type": "boolean" + "exitCondition": { + "type": "object", + "properties": { + "isEnabled": { + "type": "boolean" + }, + "condition": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Greater or equal to", + "Less than", + "Less or equal to", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + } } } } @@ -25421,17 +25645,73 @@ "type": { "type": "string", "enum": [ - "onMessage" + "reply" ] }, "options": { "type": "object", "properties": { - "message": { + "variableId": { "type": "string" }, - "resumeAfter": { - "type": "boolean" + "exitCondition": { + "type": "object", + "properties": { + "isEnabled": { + "type": "boolean" + }, + "condition": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Greater or equal to", + "Less than", + "Less or equal to", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + } } } } diff --git a/apps/docs/openapi/viewer.json b/apps/docs/openapi/viewer.json index 5a9713f20..c83f6f138 100644 --- a/apps/docs/openapi/viewer.json +++ b/apps/docs/openapi/viewer.json @@ -5436,17 +5436,73 @@ "type": { "type": "string", "enum": [ - "onMessage" + "reply" ] }, "options": { "type": "object", "properties": { - "message": { + "variableId": { "type": "string" }, - "resumeAfter": { - "type": "boolean" + "exitCondition": { + "type": "object", + "properties": { + "isEnabled": { + "type": "boolean" + }, + "condition": { + "type": "object", + "properties": { + "logicalOperator": { + "type": "string", + "enum": [ + "OR", + "AND" + ] + }, + "comparisons": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "variableId": { + "type": "string" + }, + "comparisonOperator": { + "type": "string", + "enum": [ + "Equal to", + "Not equal", + "Contains", + "Does not contain", + "Greater than", + "Greater or equal to", + "Less than", + "Less or equal to", + "Is set", + "Is empty", + "Starts with", + "Ends with", + "Matches regex", + "Does not match regex" + ] + }, + "value": { + "type": "string" + } + }, + "required": [ + "id" + ] + } + } + } + } + } } } } diff --git a/packages/bot-engine/src/events/executeEvent.ts b/packages/bot-engine/src/events/executeEvent.ts index 6993415ec..adb6d1094 100644 --- a/packages/bot-engine/src/events/executeEvent.ts +++ b/packages/bot-engine/src/events/executeEvent.ts @@ -1,9 +1,7 @@ import { TRPCError } from "@trpc/server"; import type { SessionState } from "@typebot.io/chat-session/schemas"; import type { TDraggableEvent } from "@typebot.io/events/schemas"; -import { getBlockById } from "@typebot.io/groups/helpers/getBlockById"; import { addBlockToTypebotIfMissing } from "../addBlockToTypebotIfMissing"; -import { addPortalEdge } from "../addPortalEdge"; import { getNextGroup } from "../getNextGroup"; type Props = {