Antbuddy.us
  • AntBuddy Inc Documents
    • Guide to Register and Payment
      • Register and Login
        • 1. Register
        • 2. Log in
      • Payment
    • AntCrm Customer Management
      • Settings
        • Create users
        • Create group
        • Invite users to the company
        • View permissions
        • Activity permissions
        • What is Ticket? How to create Ticket?
      • Conversation
        • Omni Facebook user guide
          • 1. Facebook integration
          • 2. Setting Up Facebook Fan page
          • 3. Message Management
            • 3.1. Sending Message
            • 3.2. Viewing Conversation History
          • 4. Comment Management
            • 4.1. Customer Support Commenting
            • 4.2. Hiding comments
            • 4.3. Editing comments
            • 4.4. Delete Comments
            • 4.5. Liking/Unliking Comments
          • 5. Post Management
          • 6. Changing the Session Owner
          • 7. Adding support user
          • 8. Tagging session
          • 9. Sending images
          • 10. Marking done
          • 11. Adding message template
            • 11.1. Add/Edit/Delete templates
            • 11.2. Using message template
          • 12. Setting Up Session Timeout
          • 13. Configuring the Timeout
          • 14. Setting Up Auto-Reply and Sending Messages
          • 15. Setting Up Response Time and Pre-Expiration Warnings
          • 16. Customer operations
          • 17. Marking unread
          • 18. Setting up Omnichannel chat Categories
          • 19. Configuring layout
        • Instagram use guide
          • 1. Instagram integration
          • 2. Using Instagram Omni conversations
            • 2.1 Guide to setting up Instagram on AntCRM
              • 2.1.1 Adding support
              • 2.1.2 Assignment configuration
              • 2.1.3 Interactive Configuration
          • 3. Manage chat with customers
            • 3.1 Send message to customer
            • 3.2 View session history
          • 4. Comment Manager
            • 4.1 Hide comment
            • 4.2 Delete comment
          • 5. Change the person assign to session
          • 6. Adding user support
          • 7. Tags for session
          • 8. Send image
          • 9. Mark as done
          • 10. Adding message template
            • 10.1 Add/Edit/Delete template
            • 10.2 Using messenger template
          • 11. Setting up session timeout)
          • 12. Setting Up Response Time and Pre-Expiration Warnings
        • Whatsapp use guide
          • 1. Integrate whatsapp on CRM
          • 2. Setting whatsapp on CRM
            • 2.1 Adding user support
            • 2.2 Setting close session
            • 2.3 ssignment Configuration
            • 2.4 Interaction Configuration
          • 3. Managing Chats with Whatsapp Customers
            • 3.1 Send message
            • 3.2 Viewing Conversation History
            • 3.3 Changing the Session's Assigned Agent
          • 4. Adding a Support User
          • 5. Tagging a Session
          • 6. Sending image
          • 7. Marking a Session as Completed
          • 8. Adding, Edit and Delete omni message template
          • 9. Session Closure Time
          • 10. Configuring the wait time
          • 11. Setting response Time and Pre-expiration Alerts
          • 12. Creating Whatsapp SMS campaign
          • 13. Sending Whatsapp SMS Campaign
          • 14. Sending the Product Carousel
          • 15. Cross-Channel Campaign Guide
          • 16. Create WhatsApp Template via Meta Business Suite
          • 17. Run Template in AntCRM platform
        • Shopee use guide
        • Live chat use guide
        • Lazada use guide
      • Report
        • View Omnichannel conversation report
      • Customer Experience Management
        • 1. Customer survey setting
          • 1.1 Conversations
          • 1.2 Call Center
          • 1.3 Rating criteria setting
          • 1.4 Setting landing page
        • 2. How to use the Agent interface
        • 3. Satisfaction Report
    • WhatsApp User Guide
      • Guide to Setting Up WhatsApp on AntCRM
      • Guide to Managing Chats with Whatsapp Customers
      • How to Add and Use Omni Message Templates?
      • Guide to Setting Session
      • Guide to Creating and sending Whatsapp SMS campaign
      • Guide to Sending the Product Carousel
      • Cross-Channel Campaign Guide
      • Guide to sending Product Sample Messages on WhatsApp (Product Catalog)
    • User manual for AntBot ChatBot
      • Integrate Omni-channel messaging with Chatbot AntBot
      • The basic features of AntBot Chatbot
      • Use Cases of AntBot Chatbot
      • Detailed explanation of the Chatbot node
      • How to create a google cloud bot
  • Integration Document Guide
    • AntRing
      • API Registration
      • Use API
      • API List
      • Error Code
    • AntBot
      • AntBot API
      • Voice OTP
      • HTTP Response
    • AntCrm
      • ApiRing AntCrm apis description
Powered by GitBook
On this page
  • 1. Start flow
  • 1.1. Introduction:
  • 3. End flow
  • 3. Example
  1. AntBuddy Inc Documents
  2. User manual for AntBot ChatBot

Detailed explanation of the Chatbot node

PreviousUse Cases of AntBot ChatbotNextHow to create a google cloud bot

Last updated 5 days ago

1. Start flow

1.1. Introduction:

  • The Start Node is used to initiate a flow, and users can set conditions for it.

1.2. Properties

  • AntCRM Account: The account used to manage AntCRM

  • Flow name: The display name for the start node

  • Page: The platform selected to use the start node

  • Types of conditions

Contains Keyword Condition: ..ab.. → Accepts any message that contains the characters "ab"

Contains Exactly Condition: ab → Accepts messages that exactly match the content "ab"

Message is a Command Condition: /command → Accepts messages that start with a "/" (slash)

Message is a Command and Starts With a Specific Word Condition: /start → Accepts messages that start with the command /start

After setting up the rules:

3. End flow

  1. Introduction

  • Used to end a flow session.

  1. Properties

  • Select the AntCRM account to be used

  1. Redirect flow

1. Introduction

  • Redirect the current flow's work to a new flow.

2. Attributes

  • Name of the flow to redirect to: Select the starting node of the flow you want to redirect to (start a different flow)

  1. Message

  1. Introduction

  • Configure the message sent from the bot to the user.

  1. Properties

  • Node name: Display name of the message output in the flow

  • Content: The content of the message being sent

  • Add version: Add another version of the message content. Multiple text messages can be sent.

  1. Comment on a post

This node is responsible for automatically responding to user comments. It enables the bot to interact and reply quickly to users on social media platforms such as Facebook, Instagram, or Twitter.

  1. Images, sound, documents and video

These nodes function similarly (for Facebook and WhatsApp). This node automatically sends images, audio, videos, and documents to users. This helps the bot present information in a more visual and engaging way.

  1. Node button

This node provides interactive nodes for users, allowing them to easily interact and choose from different options (only applicable to Facebook and WhatsApp)

  1. Quick replies

This node provides quick replies for users, helping them respond quickly without having to type again.

  1. Message Template

This node automatically sends predefined templates, helping to provide specific information or automatically perform certain actions.

  1. Actions

This node performs specific actions, such as redirecting to an agent when necessary.

  1. Menu list

  1. Introduction

  • Allows the creation of a menu of selectable nodes. The selectable nodes consist of two types: open a URL link or navigate to another node.

  1. Attributes

  • Template type: Select Menu list to start.

  • Add button: Add an option to the node.

  • Choose button type: Choose the type for the node. If selecting URL, add the web link to open the website you want to redirect to.

  • If selecting post back, only add the display name of the node.)

When selecting a node, it will navigate to a node corresponding to that node.

  1. Debug

  1. Introduction

  • Displays the selected message properties in the Debug sidebar tab and optionally in the runtime log.By default, the node displays msg.payload, but it can be configured to show any property—such as the full message or the result of a JSONata expression.

  • The Debug sidebar provides a structured view of messages, making it easier to understand their format.

  • JavaScript objects and arrays can be collapsed and expanded as needed. Buffer objects can be displayed either as raw data or as strings, if possible.

  • Next to each message, the debug sidebar includes information such as the time the message was received, which node sent it, and the type of message. Clicking the source node’s ID will highlight that node in the workspace.

  • This node can be enabled or disabled as needed. It is recommended to disable or remove any Debug node that is not being used.

  • The node can also be configured to send all messages to the runtime log or send a short (32-character) summary to the node’s status text.

  1. Properties

  • Output: Select the output content of the debug node

  • To: Choose where the output will be displayed

  • Name: Set a display name for the debug node

  1. Function

1. Introduction

  • A JavaScript function that runs based on messages received by the node.

  • Messages are passed in as a JavaScript object named msg. By convention, this object contains a msg.payload property holding the message content.

  • The function is expected to return a message object (or multiple message objects), but it can also choose to return nothing to pause the flow.

  • The On Start tab contains code that will run whenever the node is started. The On Stop tab contains code that will run when the node is stopped. If the On Start code returns a Promise, the node will wait for it to resolve before processing any messages.

  • Sending Messages

The function can return the messages it wants to send to the next nodes in the flow or use node.send(message) to do so.

It can undo /send:

  • A single message object – routed to nodes connected to the first output

  • An array of message objects – routed to the corresponding outputs of the node

Note: Setup code is executed during the node's initialization process. Therefore, if node.send is called within the setup tab, subsequent nodes may not receive the message.

  • If any element of the array is itself an array of messages, multiple messages will be sent to the corresponding output.

  • If null is returned—either directly or as an element in the array—no message will be sent.

  • Logging and Error Handling: To log information or report errors, the following functions are available:

  • node.log("Log message")

  • node.warn("Warning")

  • node.error("Error")

  • You can also use a Catch node to handle errors. To trigger a Catch node, pass the message object as the second argument to node.error:

  • node.error("Error", msg);

Accessing Node Information

The following properties are available to access information about the node:

  • node.id – the ID of the node

  • node.name – the name of the node

  • node.outputCount – the number of outputs the node has

Using Environment Variables

Environment variables can be accessed using env.get("MY_ENV_VAR").

1. Introduction

  • The Function node is used to support message processing. After processing, the message is returned.

2. Properties

  • Name: Set a display name for the Function node

  • On message: Program the methods and logic you want to use to process and return the message

  1. Change

1. Introduction

  • Used to set, modify, delete, or move properties of a message, flow context, or global context.

  • The node can define multiple rules, which will be applied in the order they are listed.

2. Properties

The available operations are:

  • Set: Assign a property. The value can be of various types or sourced from an existing message or context property.

  • Change: Search and replace parts of a property. If regular expressions are enabled, the "replace with" value can include capture groups, e.g., $1. Replacement will only change the type if a full match is found.

  • Delete: Remove a property.

  • Move: Move or rename a property.

The "expression" type uses the JSONata expression and query language.

Introduction

  • Used to perform transformations on msg, flow, and global variables.

Variable Types

  • msg: A variable scoped to a single message flow

  • flow: A variable accessible anywhere within the same flow

  • global: A variable accessible across all flows

Transformation Actions

  • Set: Assign a value to the variable

  • Change: Modify the value of the variable

  • Delete: Remove the value of the variable

  • Move: Move the value from one variable to another

  1. Http in

2. Properties

  • Outputs

  • payload

    • For GET requests: contains an object of any query string parameters.

    • For other request types: contains the body content of the HTTP request.

  • req: object

    • An HTTP request object. This object includes various properties providing information about the request:

      • body – the body content of the incoming request. Format depends on the request type.

      • headers – an object containing the HTTP request headers.

      • query – an object containing any query string parameters.

      • params – an object containing any route parameters.

      • cookies – an object containing cookies from the request.

      • files – if enabled in the node, an object containing any files uploaded as part of a POST request.

  • res: object (Note: Typically used for sending the response back to the client.)

An HTTP response object. This property should not be used directly; instead, the HTTP Response node handles how to send back the response. This property must remain attached to the message passed to the response node.

The node listens on the configured path for requests of a specific type. The path can be:

a static path such as /user, or a parameterized path such as /user/:name, where the value of the parameter can be accessed via msg.req.params.

For requests with a body (e.g., POST or PUT), the content of the request is available as msg.payload.

If the request’s content type is recognized, the body will be automatically parsed into an appropriate format. For example: application/json will be parsed into a JavaScript object.

Note: This node does not send any response to the request. The flow must include an HTTP Response node to complete the request.

  1. Http response

  1. Introduction

  • Sends a response back to the requests received from the HTTP Input node.

  1. Properties

  • Inputs

    • payload: string

      • The body of the response.

    • statusCode: number

      • If set, this will be used as the response status code. Default: 200.

    • headers: object

      • If set, provides HTTP headers to include in the response.

    • cookies: object

      • If set, can be used to set or delete cookies.

Status codes and headers can also be set directly in the node itself. If a property is set within the node, it cannot be overridden by the corresponding message property.

Cookie Handling

The cookie property should be an object of name/value pairs. The value can either be a string to set the cookie with default options or it can be an object of options.

The following example sets two cookies:

  • One cookie named name with the value nick.

  • Another cookie named session with the value 1234, and the expiration time set to 15 minutes.

msg.cookies = {

name: 'nick',

session: {

value: '1234',

maxAge: 900000

}

}

The valid options include:

  • domain - (String) The domain for the cookie.

  • expires - (Date) The expiration date in GMT. If not specified or set to 0, a session cookie will be created.

  • maxAge - (String) The expiration time relative to the current time in milliseconds.

  • path - (String) The path for the cookie. Default is /.

  • value - (String) The value to be used for the cookie.

  • To delete a cookie, set its value to null.

  1. Http request

1. Introduction

  • Sends an HTTP request and returns a response.

2. Properties

Inputs

  • url (string) If not configured in the node, this optional property will set the URL of the request.

  • method (string) If not configured in the node, this optional property will set the HTTP method of the request. Must be one of the following: GET, PUT, POST, PATCH, or DELETE.

  • headers (object) Set the HTTP headers for the request. Note: Any headers set in the node configuration will override matching headers in msg.headers.

  • cookies (object) If set, can be used to send cookies with the request.

  • payload Sent as the body of the request.

  • rejectUnauthorized If set to false, will allow sending requests to HTTPS sites using self-signed certificates.

  • followRedirects If set to false, will prevent redirects (HTTP 301). true by default.

  • requestTimeout If set to a positive number of milliseconds, will override the globally configured httpRequestTimeout parameter.

Outputs

  • payload (string | object | buffer) The body of the response. The node can be configured to return the body as a string, try parsing it as a JSON string, or leave it as a binary buffer.

  • statusCode (number) The status code of the response or error code if the request could not be completed.

  • headers (object) An object containing the response headers.

  • responseUrl (string) In case of any redirects while processing the request, this property is the final redirected URL. Otherwise, it is the original request URL.

  • responseCookies (object) If the response includes cookies, this property is an object of name/value pairs for each cookie.

  • redirectList (array) If the request is redirected one or more times, the accumulated information will be added to this property. location is the next redirect target. cookie is the cookie returned from the redirect source.

When configured in the node, the URL property can contain mustache-style placeholders. These placeholders allow you to build the URL using values from the incoming message. For example, if the URL is set to example.com/{{{topic}}}, it will automatically insert the value of msg.topic. Using {{{...}}} prevents mustache from escaping characters like /, &, etc.

node can optionally encode msg.payload as query string parameters for the GET request. In this case, msg.payload must be an object.

Using Multiple HTTP Request Nodes

To use more than one of these nodes in the same flow, care must be taken with the msg.headers property. The first node will set this property with the response headers. Then the next node will use those headers for its request—this is usually not desirable. If the msg.headers property is not changed between nodes, it will be ignored by the second node. To set custom headers, you must first clear msg.headers or reset it to an empty object {}.

Handling Cookies

The cookie property passed to the node must be an object of name/value pairs. The value can be a string to set the value of the cookie, or it can be an object with a single value attribute.

Any cookies that are requested to be returned will be passed back in the replyCookies property.

Content Type Handling

  • If msg.payload is an object, the node will automatically set the content type of the request to application/json and encode the content accordingly.

  • To encode the request as form data, msg.headers["content-type"] must be set to application/x-www-form-urlencoded.

File Upload

  • To handle file uploads, msg.headers["content-type"] must be set to multipart/form-data.

  • The msg.payload passed to the node must be an object with the following structure:

{

"KEY": {

"value": FILE_CONTENTS,

"options": {

"filename": "FILENAME"

}

}

}

The values of KEY, FILE_CONTENTS, and FILENAME must be set to the appropriate values

  1. Switch

Route messages based on the value of their properties or their sequence position.

When a message arrives, the node will evaluate each defined rule and forward the message to the corresponding output of any matching rule.

Optionally, the node can be configured to stop evaluating rules after finding a match.

The rules can be evaluated based on individual message properties, flow properties, global context, environment variables, or the result of a JSONata expression.

Rules: There are four types of rules:

  1. Value Rules are evaluated based on the configured property.

  2. Sequence Rules can be applied to message chains, such as rules created by a split node.

  3. JSONata Expressions can be provided to evaluate the entire message and will match if the expression returns a truthy value.

  4. Inverse Rules can be used to match if no previous rule has matched.

Notes:

  • True/false and null rules perform strict type comparisons. They do not convert between types.

  • Empty and non-empty rules can be used to check the length of Strings, Arrays, Buffers, or the number of flow properties an object has. Both rules will not pass if the property being checked has a boolean, null, or undefined value.

Handling Message Chains: By default, the node does not modify the msg.parts property of messages as part of a chain.

An optional setting to recreate the message chain can be enabled to generate a new message chain for each matching rule. In this mode, the node will buffer the entire chain before sending the new message. The node’s runtime setting nodeMessageBufferMaxLength can be used to limit the number of flow node messages that will be stored in the buffer.

  1. Introduction

  • The node is used to evaluate conditions and route messages based on their attribute values or their sequence position.

  • When a message arrives, the node evaluates each defined rule and forwards the message to the corresponding output of any matching rule.

  • Optionally, the node can be configured to stop evaluating rules after finding the first matching rule.

  1. Attributes

  • Variable: A variable used to apply the rule and evaluate conditions in the message, which can be an attribute of msg, flow, global, or JSONata expressions.

  1. Msg: The variable is deployed only within a small flow.

  2. Flow: The variable can be used anywhere within the flow.

  3. Global: The variable can be used everywhere.

Rule: The rule is evaluated based on the configured attribute.

  • Comparison Variable: A variable used to compare with another variable, where the variable type can be selected.

  • Add the conditions

  • Option

  • Check all rules: Check all conditions and then route accordingly.

  • Stop after the first match: Stop checking once the first correct condition is met.

  1. Range

  1. Introduction Maps a numeric value to a different range.

  2. Attributes Input

  • payload: number The payload must be a number. Anything else will attempt to be parsed as a number and will be rejected if it fails.

Outputs

  • payload: number The value mapped to the new range.

This node will scale the received value linearly. By default, the result is not limited to the range defined in the node.

Scaling and limiting the target range means that the result will never be outside the specified target range. Scaling and wrapping within the target range means that the result will be wrapped within the target range. Scaling, but clamping outside the input range means that the result will be scaled, but any input outside the input range will be discarded. For example: input 0 - 10 mapped to 0 - 100.

mode

input

output

scale

12

120

limit

12

100

wrap

12

20

drop

12

(no output)

  1. Delay

  1. Introduction Delays each message passing through the node or limits the rate at which they can be sent.

  2. Attributes Inputs

  • delay: Number Sets the delay, in milliseconds, to be applied to the message. This option only applies if the node is configured to allow the message to override the default delay time that has been set.

  • rate: Number Sets the rate, in milliseconds, between messages. This node overrides the current rate value defined in the node configuration when it receives a message containing the value msg.rate in milliseconds. This option only applies if the node is configured to allow the message to override the default rate value.

  • reset If the received message has this property set to any value, all messages that have not yet been processed by the node will be cleared without being sent.

  • flush If the received message has this property set to a number, multiple messages will be sent immediately. If set to any other type (e.g., boolean), all unprocessed messages retained by the node will be sent immediately.

to Front

When in rate-limiting mode, if the received message has this property set to true (boolean), the message will be pushed to the front of the queue and released next. This can be used in combination with msg.flush=1 to resend immediately.

When configured to delay messages, the delay duration can be a fixed value, a random value within a range, or dynamically set for each message. Each message is delayed independently of others based on its arrival time.

When configured to rate-limit messages, their transmission is evenly distributed over the configured time period. The status displays the current number of messages in the queue. It can optionally discard intermediate messages as they arrive.

If set to allow rate override, the new rate is applied immediately and remains in effect until changed again, the node is reset, or the flow is restarted.

Rate limiting can be applied to all messages or grouped by their msg.topic value. When grouped, intermediate messages are automatically discarded. At each interval, the node can release the most recent message for all topics or the most recent message for the next topic.

Note: In rate-limiting mode, the maximum queue depth can be set by a property in your settings.js file. For example: nodeMessageBufferMaxLength: 1000.

  1. Split

  1. Introduction Splits a message into a sequence of messages.

payload: object | string | array | buffer The behavior of the node is determined by the type of msg.payload:

  • string/buffer: The message is split by a specified character (default: ), a buffer string, or into fixed lengths.

  • array: The message is split into individual array elements or arrays of fixed length.

  • object: A message is sent for each key/value pair of the object.

Outputs

parts: object This property contains information about how the message was split from the original message. If passed to a join node, the sequence can be reassembled into a single message. It has the following properties:

  • id: Identifier for the group of messages.

  • index: Position within the group.

  • count: If known, the total number of messages in the group. See 'streaming mode' below.

  • type: Type of message - string/array/object/buffer.

  • ch: For a string or buffer, the data used to split the message, as a string or byte array.

  • key: For an object, the key of the property from which this message was created. The node can be configured to copy this value to other message properties, such as msg.topic.

  • len: Length of each message when splitting by a fixed length value.

This node simplifies creating flows that perform common actions on a sequence of messages, using a join node to reassemble the sequence into a single message. It uses the msg parts property to track individual parts of a sequence.

Streaming Mode This node can also be used to reshape message flows. For example, a serial device sending newline-terminated commands might send a message with a partial command at the end. In 'streaming mode,' this node splits a message and sends each complete segment. If there’s a partial segment at the end, the node retains it and appends it to the next received message.

When operating in this mode, the node does not set the msg.parts.count property, as it cannot know how many messages will be in the flow. This means it cannot be used with a join node in automatic mode.

  1. Join

  1. Introduction Joins sequences of messages into a single message.

  2. Attributes There are three available modes:

  • Automatic: When paired with a split node, it automatically joins messages to reverse the splitting process.

  • Manual: Joins message sequences in various ways.

  • Reduce Sequence: Applies an expression to all messages in a sequence to reduce it to a single message.

parts: object To automatically join a sequence of messages, all messages must have this property set. The split node generates this property, but it can also be created manually. It has the following properties:

  • id: Identifier for the group of messages.

  • index: Position within the group.

  • count: Total number of messages in the group.

  • type: Type of message - string/array/object/buffer.

  • ch: For a string or buffer, the data used to split the message, as a string or byte array.

  • key: For an object, the key of the property from which this message was created.

  • len: Length of each message when splitting by a fixed length value.

complete If set, the node appends the payload and then sends the output message in its current state. If the payload should not be appended, remove it from the message.

reset If set, the node discards any partially completed messages without sending them.

restartTimeout If set and the node has a configured timeout, the timeout is restarted.

Automatic Mode Automatic mode uses the properties of incoming messages to determine how to join the sequence. This allows it to automatically reverse the operation of a split node.

Manual Mode When configured to join in manual mode, the node can combine message sequences into various outputs:

  • A string or buffer: Created by concatenating the selected property of each message with specified joining characters or buffer.

  • An array: Created by adding each selected property or entire message to the output array.

  • A key/value object: Created by using the property of each message to determine the key for storing the required value.

  • A merged object: Created by merging the properties of each message into a single object.

The other properties of the output message are taken from the last message received before the result is sent.

You can set the number of messages the node will receive before generating the output message. For object outputs, when this number is reached, the node can be configured to send a message for each subsequent message received.

A timeout can be set to trigger sending a new message using whatever has been received so far. This timeout can be restarted by sending a message with the msg.restartTimeout property set.

If a message is received with the msg.complete property set, the output message is finalized and sent.

If a message is received with the msg.reset property set, any partially completed message is discarded and not sent.

Reduce Sequence Mode When configured to join in reduce mode, an expression is applied to each message in the sequence, and the result is accumulated to produce a single message.

Initial Value The initial value of the accumulated value ($A).

Reduce Expression A JSONata expression called for each message in the sequence. The result is passed to the next expression call as the accumulated value. In the expression, the following special variables can be used:

  • $A: The accumulated value.

  • $I: The index of the message in the sequence.

  • $N: The number of messages in the sequence.

Fix-up Expression An optional JSONata expression applied after the reduce expression has been applied to all messages in the sequence. In the expression, the following special variables can be used:

  • $A: The accumulated value.

  • $N: The number of messages in the sequence.

By default, the reduce expression is applied in order, from the first message to the last in the sequence. It can optionally be applied in reverse order.

$N is the number of incoming messages, even if they are identical.

Example: The following settings, for a sequence of numeric values, will calculate the average:

  • Reduce Expression: $A + payload

  • Initial Value: 0

  • Fix-up Expression: $A / $N

Storing Messages This node buffers messages internally to work across sequences. The runtime setting nodeMessageBufferMaxLength can be used to limit how many messages the node will buffer.

  1. Sort

  1. Introduction A function that sorts a message property or a sequence of messages.

  2. Attributes When configured to sort a message property, the node sorts the array data pointed to by the specified message property.

When configured to sort a sequence of messages, it reorders the messages.

The sort order can be:

  • Ascending

  • Descending

For numbers, numerical order can be specified using a checkbox.

The sort key can be the element value or a JSONata expression to sort by a property value, message property, or a JSONata expression to sort a message sequence.

When sorting a sequence of messages, the sort node relies on received messages to set msg.parts. The split node generates this property, but it can also be created manually. It has the following properties:

  • id: Identifier for the group of messages.

  • index: Position within the group.

  • count: Total number of messages in the group.

Note: This node internally buffers messages for its operation. To prevent unwanted memory usage, you can specify the maximum number of messages to be buffered. There is no limit on the number of messages by default. The nodeMessageBufferMaxLength property can be set in settings.js.

  1. Batch

  1. Introduction Generates sequences of messages based on various rules.

  2. Attributes There are three modes for generating message sequences:

Number of Messages Groups messages into sequences of a specified length. An overlap option determines how many messages at the end of one sequence are repeated at the start of the next sequence.

Time Interval Groups messages arriving within a specified time interval. If no messages arrive during the interval, the node can optionally send an empty message.

Sequence Join Generates a sequence of messages by joining incoming sequences. Each message must have an msg.topic property and an msg.parts property defining its sequence order. The node is configured with a list of topic values to determine the order of the joined sequence.

Storing Messages This node buffers messages internally to operate on sequences. The runtime setting nodeMessageBufferMaxLength can be used to limit the number of messages the node will buffer.

If a message is received with the msg.reset property set, buffered messages are cleared and not sent.

  1. Inject

  1. Introduction Injects messages into a flow manually or periodically. The message payload can be of various types, including strings, JavaScript objects, or the current time.

  2. Attributes

Outputs

payload: Various The configured payload of the message.

topic: string An optional property that can be configured in the node.

The Inject node can start a flow with a specific payload value. The default payload is a timestamp of the current time in milliseconds since January 1, 1970.

This node also supports injecting strings, numbers, booleans, JavaScript objects, or global/flow context values.

By default, the node is triggered manually by clicking its node in the editor. It can also be set to inject regularly or on a schedule.

It can be configured to inject once each time the flows are started.

The maximum interval can be specified as approximately 596 hours (24 days). However, for intervals longer than a day, consider using a scheduler node that can handle power losses and restarts.

Note: The "Interval between times" and "at a specific time" options use the standard cron system. This means 20 minutes will occur at the next hour, 20 minutes past, and 40 minutes past—not every 20 minutes. For an injection every 20 minutes from now, use the "interval" option.

Note: To include a newline in a string, a Function or Template node must be used to create the payload.

  1. Complete

  1. Introduction Triggers a flow when another node completes processing a message.

  2. Attributes If a node reports at runtime when it finishes processing a message, this node can be used to trigger a secondary flow.

For example, this can be used with a node that has no output, such as an Email sending node, to continue the flow.

This node must be configured to handle events for specific nodes selected in the flow. Unlike the Catch node, it does not provide an 'handle all' mode that automatically applies to all nodes in the flow.

  1. Catch

  1. Introduction Catches errors thrown by nodes on the same tab.

  2. Attributes

Outputs

error.message: string The error message.

error.source.id: string The ID of the node that caused the error.

error.source.type: string The type of node that caused the error.

error.source.name: string The name, if set, of the node that caused the error.

If a node throws an error while processing a message, the flow typically stops. This node can be used to detect those errors and handle them with a dedicated flow.

By default, the node detects errors thrown by any node on the same tab. Alternatively, it can be targeted to specific nodes or configured to only detect errors not caught by 'targeted' Catch nodes.

When an error occurs, all matching Catch nodes receive the message.

If an error is thrown in a subflow, it is handled by any Catch nodes within that subflow. If none exist, the error is propagated to the tab where the subflow instance is active.

If the message already has an error property, it is copied to _error.

  1. Status

  1. Introduction Reports status messages from other nodes on the same tab.

  2. Attributes

Outputs

status.text: string The status text.

status.source.type: string The type of node reporting the status.

status.source.id: string The ID of the node that reported the status.

status.source.name: string The name, if set, of the node that reported the status.

This node does not generate a payload.

By default, the node reports the status of all nodes on the same workspace tab. It can be configured to selectively report the status of individual nodes.

  1. Link in

  1. Introduction Creates virtual wires between flows.

  2. Attributes This node can be connected to any output Link node existing on any tab. Once connected, they function as if directly wired together.

Wires between Link nodes are only displayed when a Link node is selected. If there are any wires leading to other tabs, a virtual node appears, and you can click it to navigate to the appropriate tab.

Note: Links cannot be created into or out of a subflow.

  1. Link call

  1. Introduction Calls a flow starting with a Link In node and passes the response.

target: string When the Link Type option is set to "dynamic target," set msg.target to the name of the Link In node you want to call.

This node can be connected to a Link In node existing on any tab. The flow connected to that node must end with a Link Out node configured in 'return' mode.

When this node receives a message, it forwards it to the connected Link In node. It then waits for a response before proceeding.

If no response is received within the configured timeout period (default: 30 seconds), the node logs an error that can be detected by a Catch node.

When the Link Type option is set to "dynamic target," msg.target can be used to call a Link In node by its name or ID.

  • If there is a Link In node with the same ID, it will be called.

  • If there are two or more Link In nodes with the same name, an error will occur.

  • A Link Call cannot invoke a Link In node inside a subflow.

The flow connected to the target node must end with a Link Out node configured in 'return' mode.

  1. Link out

  1. Introduction Creates virtual wires between flows.

  2. Attributes This node can be configured to either send messages to all Link In nodes it is connected to or send a response back to the Link Call node that triggered the flow.

When in 'send to all' mode, the wires between Link nodes are only displayed when the node is selected. If there are any wires leading to other tabs, a virtual node appears, and you can click it to navigate to the appropriate tab.

Note: Links cannot be created into or out of a subflow.

  1. Comment

  1. Introduction A node used to add comments to your flow.

  2. Attributes The edit panel accepts Markdown syntax. The text will be displayed in the sidebar info panel.

  3. API Explanation

  4. Get request

  • The GET request does not require any initial input; simply send the request to the API and receive the response in msg.payload.

  1. Post request

  • The POST request requires input data, which you can provide using a function button.

  • After sending the payload and data, the response will appear in msg.payload.

  1. API Authorization

  • In the HTTP request node, select "Use authentication", then choose the type of authentication you want. After that, enter the token and password.

  1. Generative AI API’s

  • Enter the API URL into the HTTP Request node to integrate the API.

  1. API Response Status Code

The status code is stored in msg.statusCode:

  • 200: Success

  • 404: Failure

  1. Conditions based on the API Response

Depending on msg.statusCode and a switch node, you can define different actions based on the API response.

3. Example

1. Gửi ảnh

  • Name: Display name of the image node Url: URL of the publicly accessible image

2. Delay 2s

  • Action: Setting action delay

  • Delay each message

  • Fixed delay

  • For: Set delay time

3. Send message

1. Enter user information

  1. Initialize some variables to enter user information

  • "First time": to confirm that the user is entering for the first time.

  • If (first time == true)

    Create "con": This means checking or notifying. This variable is used to direct the flow, informing the user of the information they need to input or verifying and saving the information.

    "check" value: To enter the validation flow (authentication) for the user’s input, then save it if it's correct.

    "notice" value: To input a notification message from the bot to the user, then change con == "check" to redirect to the "check" flow.

  • Create "name": This means the name of the information you want the user to provide.

    name == "company": Get the company name name == "name": Get the user’s name name == "email": Get the email

  1. Notification flow

  • After checking the information to be retrieved, guide the user through the process.

  • After successfully notifying:

    Change "con" to check the user's input and wait for the user to enter some content. Change "first time" to false. If first time remains true, the variables will be reset.

  1. Check flow: Verify the process or direction of actions.

    Check authentication: Validate if the user’s input or credentials are correct.

    Save information: Store the validated user input or information securely.

  • Check if the entered name contains numbers. If it contains numbers, notify the user and allow them to enter it again.

  • Check if the entered email contains "@" and ".". If it does not contain both, notify the user and allow them to re-enter it. Once the email is entered correctly, change "first time" to true to start a new flow.

  1. Send a thank you message.

  1. Handover service

  • After sending the thank-you message, direct the flow to handover.

    Set up an action button:

    Add: "Hand over".

Attributes

Attributes

Inputs
Inputs
Inputs