# Welcome

DMflow\.chat chatbot allows users to easily design their own customized bot processes, whether for complex designs or simple domain calls. All can be achieved.

{% hint style="info" %}
All documents have been translated using automatic translation software to help you understand the basic content. We have taken reasonable measures to provide an accurate translation, but we do not guarantee the translation's accuracy. If you have any questions about the accuracy of the translation, please refer to the [original docs](https://docs.dmflow.chat) of the document.
{% endhint %}

### Overview

Welcome to the DMflow\.chat documentation. Here, you will learn how to create your first bot instance using DMflow.

### Platform Structure

The DMflow platform is divided into two main components: **Domains** and **Bots**.

#### Domains

Domains guide bots to use additional skills. The main content includes six categories:

1. Intent-Based
2. Question and Answer (Q\&A) Pairs
3. Table Q\&A
4. Form Q\&A
5. Chat
6. Document Q\&A

Currently, only the following categories are available for use:

* Form Q\&A
* Chat
* Document Q\&A
* Q\&A Pairs

#### Bots

Bots are designed to provide users with a framework for designing bot processes. Depending on your purpose, you can design complex workflows or simply call domains for a basic bot structure.

### Future Updates

We will be releasing supplementary videos to accompany this documentation in the near future.

{% embed url="<https://www.dmflow.chat>" %}
DMflow\.chat official
{% endembed %}

{% embed url="<https://app.dmflow.chat>" %}
DMflow\.chat application Login Page
{% endembed %}


# Contact

Email: <mailto:service@dmflow.chat>

Company: 拓遠資訊有限公司


# Nounce

## Common Terms and Definitions

* **Agent**: A human customer service representative.
* **LLM (Large Language Model)**: A sophisticated language model used for natural language processing tasks.
* **sitemap.xml**: A website map file used to provide search engine crawlers with an understanding of the website's structure and content.
* **DMflow\.chat**: The name of this product.
* **Prompt**: A keyword or phrase used to trigger responses from a large language model.
* **Branch**: A process flow branch that includes conditional judgments (true/false).
* **Fallback**: A default response mechanism used to handle situations where no specific conditions are met.


# Get Started

How to Quickly Get Started with dmflow\.chat


# Creating and Publishing a Bot

Creating a chatbot with DMflow\.chat is a simple and intuitive process, accessible to both technical and non-technical users. With a few easy steps, you can quickly set up a chatbot and start enjoying its benefits.

You can also create chatbots for various tasks, achieving any bot functionality you desire, based on your capabilities.

### Prerequisites: <a href="#xian-jue-tiao-jian" id="xian-jue-tiao-jian"></a>

You must first create a tenant or be invited by a tenant owner. To create a tenant owner, please refer to the [DMflow.chat registration page](https://app.dmflow.chat/auth/register)

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FSvum96oFSqU9U1UvoLMK%252Fcreate-bot.png%3Falt%3Dmedia%26token%3Dcfca17af-f3bd-4044-86ac-91df402d3c0c&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=dfef055e&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Creating a Bot

Once created, you can design your bot by navigating to 'Conversation Flow'.

Testing the Bot

In 'Conversation Flow', click 'Test' at the top to open a window displaying the respective channel windows.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FNhqMXqUmTBYfrXFGlyP4%252Fbot-test-button.png%3Falt%3Dmedia%26token%3D141b0cfe-3ef1-481e-9ae1-3ce89ede11c1&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=b3a4808f&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Conversation Flow Testing

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FF8r9KwkCfwCRpzKH9GP5%252Fbot-test-demo.png%3Falt%3Dmedia%26token%3D3792b76d-81f0-4ffb-aa88-fb97580d0516&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=c43dafac&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Testing Options

You can configure test variables based on scenarios (different application areas), perspectives (different channels), and whether to use called functions during testing.

### Publishing the Bot <a href="#fa-bu-ji-qi-ren" id="fa-bu-ji-qi-ren"></a>

Click 'Save' (second from the left in the same row as the 'Test' button) to add a development version of the bot. Then, in the 'Conversation Flow' section, find 'Publish' to synchronize it to the production version.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FwYzhSD9jBOTiGukJNhoA%252Fpublish-bot.png%3Falt%3Dmedia%26token%3D29429f92-f62e-496c-acc7-f6b406a971e0&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=1600ff64&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Publish

### Select Channel <a href="#xuan-qu-qu-dao" id="xuan-qu-qu-dao"></a>

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252F6bJaFJc3zE7ihRPch1Ob%252Fbot-channel-choose.png%3Falt%3Dmedia%26token%3Da0b73a98-cd61-42f1-b6b4-31c51debfed0&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=97202a1c&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Select Channel

Currently, we support LINE, Messenger (Facebook), Telegram, Instagram, WebChat, and WhatsApp.


# How to Share Your Bot

To share your DMflow\.chat bot, simply click 'Share'.

Go to 'Web Options', select 'Share', and add <https://app.dmflow.chat> to your domain whitelist. Then, you can visit <https://app.dmflow.chat/s/@8aYK2AoGe0e>, where @{{ID}} is your own bot ID.

**Features of Using the Embedded Web Chatbot:**

* Limits the number of conversations per IP per hour (currently defaults to 100 conversations per visitor per hour).
* Allows you to experience the chatbot immediately without setting up any webpage.


# DMflow\.chat Features

**Specifications Description**

**Continuous Integration/Continuous Delivery**:

* Has a development version and can be published to the production version with one click.

**Multi-Channel Support**:

* Web Chat
* LINE
* Facebook Messenger
* Instagram
* Telegram
* WhatsApp

**Security**:

* Encryption at rest and in transit
* Separates HTTP resource calls from configuration

**Graphical Flow**:

* Low-code drag-and-drop user interface

**Multi-Scene**:

* Conversation can be interrupted (Scene A -> Scene B -> B ends -> A continues)
* Can use wake-up mode (chatbot is activated only when the customer inputs a matching string)

**Calling Various Domain Skills**:

Testing:

* Simulates channel-specific output (also provides JSON for unsupported channels, e.g., LINE Flex)
* Can disable HTTP resource calls during testing and use test variables

Domain Skills:

* Form Q\&A (for data storage, you can use it to execute simple SQL)
* Chit-chat (general Q\&A), provides tool invocation
* Document Q\&A (unstructured Q\&A), provides time limits

Customer Service:

* Supports live customer service across all channels


# Abuse Prevention

Limits:

* The current web rate limits can be found in the DMflow\.chat Features section. Except for Facebook Messenger and Instagram, which are unlimited through hosted mode, other channels are limited to a maximum of five messages processed per second.

Why Limits:

* Because the tokens, secrets, and verify\_tokens of non-hosted channels are mostly provided by tenants, they are vulnerable to malicious tenant attacks on the public endpoints.

Quotas:

| Name                       | Free Quota                | Light Quota                                  | Other Descriptions                                                       |
| -------------------------- | ------------------------- | -------------------------------------------- | ------------------------------------------------------------------------ |
| Attachment Size            | 5MB                       | 5MB                                          | Paid versions are adjustable (additional fees apply)                     |
| Maximum List Size per Form | 1000                      | 50,000                                       |                                                                          |
| Document Q\&A File Limit   | 5MB (Quantity: 5)         | 5MB (Quantity: 100)                          | Use sitemaps to crawl static websites and URLs to crawl dynamic webpages |
| Maximum Form Text Limit    | 16384                     | 16384                                        |                                                                          |
| Storage Size               | 100MB                     | 1GB, increasing with user numbers            | Gradually increases                                                      |
| Trigger API                | API unavailable           | Maximum 100 times per hour (including loops) |                                                                          |
| AI Call Limit              | 1000 AI credits per month | 1500 AI credits per month                    |                                                                          |
| Channel Limit per Second   | 5                         | 5                                            |                                                                          |
| Number of Bots             | 1                         | 1                                            |                                                                          |
| Number of Domains          | 3                         | 3                                            |                                                                          |
| Maximum Scenes per Bot     | 5                         | 5                                            |                                                                          |


# Roadmap

Currently, the primary focus is on releasing and bug-fixing for the Desktop/Android/iOS APP platforms.

Secondly, UI/UX improvements.

Finally, new features.

* Teaching robot to support automatic design of form schema, robot flow, and dashboard functions through Q\&A.
* Integrating forms with web output on the sharing page, binding to your own domain.
* Adding tags for agents, rather than robot-pushed tags.

The product will also periodically remove some less frequently used features.


# Tenant


# Tenant Management

The Tenant Management page is only visible to tenant owners.

Account Management:

* Allows the creation of customer service groups.
* Enables inviting other users to use this tenant.
* Permits inviting DMflow\.chat users to the tenant (this account has the same permissions as a regular account; for customization, please consult customer service first). DMflow\.chat users do not count towards the account user limit.

Payment Information:

* You can directly use PayPal for payment, we do not store your credit card information.

Settings:

* Settings is where you manage third-party channels. Remember to enable the channel activation before starting integration.

<figure><img src="/files/PAdSqY70ejIMgAReIFlz" alt=""><figcaption><p>settings</p></figcaption></figure>

Statistics:

* Statistics allows you to view agent statistics, current attachment usage, total memory character count (you can clear some expired memories here), message statistics, credit statistics (AI credit usage), and session usage count.

<figure><img src="/files/X6DcLhT6tNcFNri8wbor" alt=""><figcaption><p>Statistics</p></figcaption></figure>

AI Credit Management:

* If you are using the additional credit purchase service, the credits will be stored here. You can transfer them to real credits when you want to use them.


# Introduction

The following will introduce the usage of Document Q\&A, Chit-chat, and Form Q\&A.

Domain naming currently only supports a-z\_ usage. Language currently only supports Chinese and English. Language includes some default answers that are not set, which will use the default language answers. For Form Q\&A, it will affect the search results."

<figure><img src="/files/Tyuc8tJlIiphAF3ex7XZ" alt=""><figcaption></figcaption></figure>


# Domain Management

This is divided into three main sections: Default Replies, API Management, and Bot Management.

Default Replies:

* This is where you set default replies, such as fallback, quit, and the default welcome message. If not set, it will default to the domain's default language for the default replies.

<figure><img src="/files/R7Zezk4siGPvkundClxM" alt=""><figcaption></figcaption></figure>

API Management:

* You can manage APIs here. Please note that the secret key cannot be viewed again after fifteen minutes of generation, so be sure to save it.

<figure><img src="/files/Ndezigqkk4zqNZmUDyGe" alt=""><figcaption></figcaption></figure>

Bot Management:

* Add bots to allow them to use the domain. Currently, AI agents can be called even if they are not enabled, but flow-based bots need to be enabled to be called.

<figure><img src="/files/FdpMttsi5Ff8oagkSoFT" alt=""><figcaption></figcaption></figure>

Additional Notes:

* The first time you use a domain for a bot to call, you need to convert the development version to the production version for the bot to call the domain. This action only needs to be done once, as subsequent designs are updated in real-time and will not require repeated publishing to the production version.

<figure><img src="/files/uLaVQQ5U30AK8zp0RZkZ" alt=""><figcaption></figcaption></figure>


# Document Q\&A

The DMflow\.chat chatbot supports uploading various file formats, automatically analyzing and saving the content. It features sitemap.xml crawling, content expiration settings, and feedback management.

You can upload files in formats such as CSV, JSON, HTML, DOCX, PDF, and voice to the DMflow\.chat platform. The system will automatically analyze and save the analyzed content.

Advantages over Other Platforms:

* Provides sitemap.xml upload functionality:
  * The platform automatically crawls and analyzes webpage content. When customers inquire about related information, the system provides direct webpage click links. (Currently, sitemap/rss/atom only supports static webpage crawling; dynamic webpages can only be crawled by selecting a single webpage.)
* Set content expiration time:
  * You can set the expiration time for files. After the expiration time, the platform will no longer extract the file's content.
* User feedback management:
  * You can view user feedback on Q\&A (such as "useful" or "not useful") through log tags and modify them.
* Data Analysis:
  * provides Retrieval Precision, Retrieval Recall, Answer Relevancy, Answer Faithfulness, and historical data to help you to make more accurate RAG.
  * Regardless of whether you use AI agents, chit-chat roles, or document Q\&A, as long as you use the knowledge base function, the following data will be stored. You can remove this question from the UI by marking it as completed.


# How to Use Document Q\&A

How to quickly implement Document Q\&A with DMflow\.chat

Go to 'Domain' and click on the new Document Q\&A you created.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FlqBC32z18lYu3mMSOxej%252Fdmflow-docqa.png%3Falt%3Dmedia%26token%3De22ffba0-ac94-4602-9d4e-cbc5708d16f7&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=6d89631c&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Document Q\&A Page

You will see the following upload options:

* File: Currently limited to 5MB, supports uploading PDF, CSV, JSON, HTML, DOCX.
* Audio: Currently limited to 5MB, file formats: mp3; m4a; wav.
* Dialog: Upload CSV for Q\&A.

Additional Configurations:

* Expiration Time
* Categories (can cluster questions more precisely through large language models)

File:

* No character limit.
* CSV allows selecting several items as a group for chunking.
* JSON allows selecting several items as a group and using JSON Pointer to specify paths.
* HTML allows uploading HTML files or using links; supports XML (sitemap, rss, atom); can filter based on links, titles, and descriptions (only filters items present in the XML, not the content after website extraction).

Audio:

* 5MB, supports mp3, m4a, wav.

Dialogue Context:

* You can directly upload questions and answers, organized into CSV format.
* CSV headers are type, sentence, session\_id.
  * type: can select Q or A.
  * sentence: select the content of your Q or A.
  * session\_id: if the session\_id is the same, the same Q and A will be kept in the same chunk as much as possible."


# How to Optimize Document Q\&A

In addition to adjusting the document content yourself, how can you add answers that are already confirmed? This article will provide the answers.

Besides the document evaluation function, you can optimize answers by using syntax completion, filling in questions and replies, and providing reference URLs.

Syntax completion can optimize your answers and add card replies. Card replies allow you to promote your products through advertisements when keywords are matched.

If syntax completion is used for Document Q\&A (advanced features not enabled) and the reply's similarity to the question is greater than 0.9 (different languages are considered dissimilar), it will be sent directly without deducting AI credits.

Future integrations may include categories or the ability to provide relevant document IDs for concurrent searches.

<figure><img src="/files/0PkzMTA7KrKhAHtd9CWK" alt=""><figcaption></figcaption></figure>


# Chat

Chat responds to questions through preset prompts. There are two parts to understand: Prompts and Few-Shot Conversations.

Using DMflow\.chat's platform's default prompts and few-shot dialogues, the bot can accurately answer questions. It supports skills like translation and sentence polishing and provides an SQL query tool. It has document query, creation, search, and update capabilities. Voice recognition and image recognition models are now available. Improve customer service efficiency and enhance customer satisfaction.

Chat can be understood in two parts: Prompt and Few-Shot Dialogues.

Prompt

The prompt is the key to the bot's ability to answer user questions based on the prompt content. If you are unfamiliar with prompt usage, you can select the role SYS\_PROMPT in our provided test menu to get useful prompt suggestions through dialogue. You can insert the following {{...}} into the prompt, and the corresponding message text will be automatically added. {{user\_profile}} can display {email, username, phone} {{cur\_time}} can display the current time. Other variables can be customized as needed.

Few-Shot Dialogues

Few-shot dialogues are pre-defined templates that the bot should use to answer user questions. The bot will subsequently answer user questions based on these templates.

Usage

You can set up some default skills (e.g., translation, sentence polishing, etc.) here for the chat agent to call. Additionally, we provide a tool to query form Q\&A, which can convert user questions into SQL statements to retrieve corresponding content from the form and provide it to the user.

Why Use This Q\&A?

Chat is used to provide chat agents with callable functions, making it convenient to output dialogues based on pre-set methods for each use. Provides form search functionality for third-party channel users.

Chat currently offers the following tools:

* Query Document: Searches the data content of Document Q\&A.
* Add Document: Creates a new entry based on the selected form (creation permissions ignore form permissions; as long as the role has the permission, it can add entries, regardless of form permissions).
* Search Document: Searches based on the selected form, but only searches within the user's accessible form permissions.
* Evaluation: Asks for satisfaction feedback at the end of the answer.
* Collect User Data: Collects visitor email, username, and phone information.
* Voice Recognition: File size must be less than 5MB, and audio length must not exceed 1 minute.
* Image Recognition: File size must be less than 5MB.
* Recommended Questions: Automatically suggests up to three follow-up questions for the user.
* Google Routes API: Queries location and distance.
* Custom Resources: Allows calling your own API; limits the returned payload size to 4K.
* Recommended Products: Queries products from our product list.
* Query Reservation: Queries the top ten reservation options based on start and end times (for forms with reservation components).
* Collect User Tags: Automatically adds visitor tags.
* Get Insert Form Link: Provides an external link for visitors to automatically connect to our form function.
* Query Location: Uses code to determine latitude and longitude distance.
* Persistent Memory Storage: Allows saving, searching, and deleting visitor memory.


# How to Use Role chat

How to quickly implement role-chat with DMflow\.cha

Go to 'Domain', click on the new role-chat you created, and then click 'Add Role'. You will see the following image.

<br>

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252F6WYB9isj7sRCrCXh9TQH%252Fdmflow-gossip-add.png%3Falt%3Dmedia%26token%3D9a8a0d8c-3f4f-447b-84d6-705036c77478&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=e0651998&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Add Role

Profile Picture:

* You can use the default or upload your own. After switching roles, the profile picture on LINE and the web will change to the one you selected.

Prompt:

* You can write your own prompt. If you don't know how to fill it in, you can go to the test menu and select SYS\_PROMPT to automatically generate simple prompts (Gemini cannot use this; you must switch to ChatGPT).
* Generally, it is recommended to include Character, Skills, and Constraints.
  * Character: Used to describe the personality, profession, abilities, etc., of the bot you want to create.
  * Skills: Can be divided into sub-items, such as Skill 1, Skill 2, etc.
  * Constraints: You can describe some limitations, such as output restrictions, output language, etc.

Prompt Example (Simple Article Generation):

* Character:
  * You're a proficient article rewriter with a deep understanding of SEO in Traditional Chinese. Your task is to reorganize and enhance the original article provided by the user with a new title, description, and content. You will also extend your own knowledge to add detailed explanations for each subtitle, include any relevant links, and ensure the content is split into more paragraphs for better readability.
* Skills:
  * Skill 1: Reorganize and Enhance Articles
    * Split the content into more paragraphs for better readability.
    * Provide detailed explanations for each subtitle.
    * Include any relevant links.
  * Skill 2: Extend Knowledge and SEO Optimization
    * Extend your own knowledge to provide additional information.
    * Ensure the article is optimized for SEO with relevant keywords.
    * Translate and rewrite the content into Traditional Chinese.
* Constraint:
  * The rewritten article must not be identical to the original.
  * The output should be formatted in markdown.
  * The language of the output should be Traditional Chinese.

History Record Count:

* You can select 0-30 records. If you want to use AI for marketing, the longer the better. If you want AI to perform specific tasks, the shorter the better.

Few-Shot Examples:

* You can write fixed-pattern questions and answers before asking, so that AI will answer based on your previous records.

Welcome Message:

* When using @ or # (Telegram) followed by the AI name, it can be called directly. After calling it, the welcome message will be displayed first. You can write information about using this AI here.

Voice Prompt:

* Because voice messages cannot be sent together with text in each channel, you need to fill this in advance. After uploading the voice message, it will be sent together with this prompt.

Voice Limitations:

* Currently, voice messages are sent separately and not based on context.
* Within 5MB and within one minute.

Image Prompt:

* Because images cannot be sent together with text in each channel, you need to fill this in advance. After uploading the image, it will be sent together with this prompt.

Image Limitations:

* Currently, images are sent separately and not based on context.

Other Options:

* If similar questions occur in consecutive turns, the previous answer will be used directly. The system automatically determines user queries, and if two queries are similar, it will directly use the historical answer to respond to the visitor.
* Conversation turn limit, 0 for unlimited.

Skills:

* Please refer to the next section on chit-chat tools for detailed information.


# Role-Chat Tools

What is Role-Chat? Role-chat integrates Document Q\&A and Form Q\&A.

How to find domain\_id and table\_id for reference? Most will have auto-suggestion functionality, but some newer tools may not.

How to find domain\_id

How to find table\_id

search\_table:

* domain\_id: Select the domain of the form (must be Form Q\&A).
* table\_id: Select the ID of the form.
* You can query the form content via "SQL". The searched content is based on visitor permissions. You can go to Form Permissions and integrate CARD output.

Card Output:

* You can map the searched content to the corresponding fields and use 'Preview' to preview.

rate\_conversation:

* Determines if the customer intends to leave and asks the customer if the conversation was "helpful" or "not helpful". This will be automatically logged.

search\_knowledge:

* domain\_id: Select the domain of the form (must be Document Q\&A).
* description: Describe the search term.
* This tool automatically calls the Document Q\&A content for answering.

collect\_user\_info:

* username
* email
* phone
* Set the above to true to allow the bot to update user information based on user conversations.

create\_table\_data:

* domain\_id: Select the domain of the form (must be Form Q\&A).
* table\_id: Select the ID of the form.
* trigger\_id: Trigger ID.
* Use this tool to add form content. Calling this tool does not require setting form permissions; insertion permissions are sufficient. After successful insertion, the trigger will be called.

human\_agent\_help:

* Use this tool when a user needs live agent help. It will automatically fallback and log the visitor's question in the shared notes.

auto\_suggestion:

* Use this tool to automatically add up to three recommended user queries.

googlemap\_routes\_api:

* api\_key: Encrypt the API key in the settings first, then enter it.
* limit: The original maximum is 25; you can set it to 1-25. It will filter the closest distances via straight-line distance calculation before calling this API.

Encryption API KEY Location:

custom\_service:

* Allows you to call your own API, but the payload cannot exceed 4K (CJK characters count as 1, other languages approximately 3-5 letters per length 1).
* resource\_id: Resource ID.
* name: functionName (equivalent to the name of the LLM calling tool).
* description: function Description (equivalent to the description of the LLM calling tool).
* parameters: {name: string, description: string, type: 'string' | 'number' | 'boolean' | 'string\_array', require: boolean, enums: string}.
* Parameter section, only supports string, number, boolean, and string array. Object array is currently not supported. Enums can be separated by '|', for example: Chinese|English|Japanese. Resource nodes will be introduced later.

suggestion\_items:

* Uses the built-in product search function.

search\_reserve\_range:

* You must first select a form with a reservation component to use this function.
* domain\_id
* table\_id
* description: Allows the LLM to understand what object you want to reserve.

collect\_user\_tag:

* Use this tool to collect visitor tags. If the tag name exists in the visitor's tags, it will be added.
* {name: string, description: string}\[]

get\_form\_link:

* Retrieves the external link for inserting a form component, binding the visitor's identity.
* array name, description, table\_id

code\_geodesic:

* Uses code to determine latitude and longitude distance.

store\_memory:

* Allows you to store, query, and remove visitor persistent memory.


# Product List

What is a product list? Simply put, if searching through forms is done by price and text, a product list represents searching for products using RAG (Retrieval-Augmented Generation).

Product lists can be uploaded in bulk or added individually. Currently, only 1000 items can be uploaded, so we provide SPU IDs for testing purposes.

Product List

When enabled or disabled, the product will no longer be searchable. You can learn how to use the API to disable products through the API section.

Add List

You might wonder how to recommend products without any interaction. Please use the memory tool in the [Role-Chat Tools](/domain/chat/gossip-tools).


# Form Q\&A

Provide forms for users to fill out. When using the form Q\&A feature, special attention needs to be paid to two parts: triggers and form creation.

**Form Purpose** The purpose of forms is actually to supplement operations outside of channel chats, such as: Facebook/Instagram post replies, Email replies, or post creation and replies on other platforms. However, the currently completed functionality is still limited, resulting in lower utility of form Q\&A at present.

**Triggers** Triggers allow users to perform add, modify, delete, and query operations. You can set up corresponding buttons in the form to trigger these operations. Additionally, you can preset triggers that will be displayed along with the welcome message, which can be executed by clicking.

**Form Creation** When creating a form, you can set up the following types of fields: keyword, number, date, boolean, and text.

**Keyword**

* Keywords require an exact match for querying. They are suitable for tags, selections (select) with menus. Currently, the total length cannot exceed 255 characters.

**Number**

* Definition: A numeric type field, suitable for storing and processing numerical data.

**Date**

* Definition: A date type field, suitable for storing and processing date data.

**Boolean**

* Definition: A boolean type field, used to represent yes or no states.

**Text**

* Definition: Text fields are suitable for storing long text, currently with a length limit of 1024 characters. Due to third-party communication products usually having length restrictions on text messages, if the text content is too long, it is recommended to turn off the display function of this field to avoid failure when sending.


# Trigger

DMflow\.chat chatbot supports integration with LINE messages, LINE Notify, OpenAI's Chat, Image, Audio, SendGrid email, Telegram messages, Openrouter, as well as Google Calendar and Google Drive.

Triggers in DMflow\.chat initiate actions when a conversation button is clicked. The trigger process involves checking for errors in the input text and can call a predefined LLM (default is Gemini 1.5 flash in version 1.0.17) to supplement the text.

#### Trigger Process Components

1. **IF**: Directs the process to a true or false node based on conditions.
2. **ASSIGN**: Stores content obtained from the conversation into specific fields.
3. **RESPONSE**: Generates new conversation output based on the filled Prompt, and the output can be stored via the ASSIGN node.
4. **ERROR**: Outputs an ERROR node and forcibly ends the conversation if the input field content is incorrect.
5. **STOREQUERY**: Extracts JSON from a piece of dialogue, which includes text, files, or other information. These details are saved using the ASSIGN node.

#### Background Process

The background process executes after the trigger process reaches END and completes storage, updates, or deletions. It processes the data generated by the trigger process further.

**Default Background Process Components**

1. **HTTP**: Calls external HTTP resources.
2. **IF**: Same as in the trigger process, directing the process based on conditions.
3. **ASSIGN**: Same as in the trigger process, for storing content.
4. **LOOPS**: Loops through based on specified fields.
5. **SEARCH**: Queries data from forms.
6. **INSERT**: Inserts new data (new row).
7. **UPDATE**: Modifies data for a specified ID.
8. **DELETE**: Deletes data for a specified ID.

**Additional Background Process Components**

* **LINE**: Sends messages via LINE (Push).
* **LINE notify**: Uses LINE notify.
* **OpenAI**: Supports Chat, Image, Audio.
* **SendGrid**: Sends emails.
* **Telegram**: Sends messages.
* **Openrouter**: Uses other LLM products.
* **Google Calendar**
* **Google Drive**

#### Pending Review Components

* **Gmail**

#### Notes

Background trigger calls use tenant-provided keys, which are encrypted in the database. For any concerns, please avoid using the feature. Apart from test calls, trigger invocations are not recorded, but tenants can view their trigger call records.


# LINE

### Action

| Resource     | Operation  | Description         |
| ------------ | ---------- | ------------------- |
| Notification | Send       | Send notify message |
| Message      | Send Text  | Push Text message   |
|              | Send Image | Push Image message  |
|              | Send Audio | Push audio message  |
|              | Send Video | Push video message  |

\*\* LINE resources are authenticated using two different methods and thus cannot be grouped under the same node.


# Gmail

### Action

| Resource | Operation    | Description                  |
| -------- | ------------ | ---------------------------- |
| Message  | Send         | Send Message                 |
| Draft    | Create       | Create Draft                 |
| Thread   | Reply        | Reply Message                |
|          | Get a Thread | Get All Same Thread Messages |


# Google Calendar

### Action

| Resource | Operation | Description  |
| -------- | --------- | ------------ |
| Event    | Create    | Create event |
|          | Delete    | Delete event |
|          | Update    | Update event |


# Google Drive

### Action

| Resource | Operation | Description   |
| -------- | --------- | ------------- |
| File     | Upload    | Upload File   |
|          | Delete    | Delete File   |
|          | Share     | Share File    |
|          | Update    | Update File   |
|          | Download  | Download File |
| Folder   | Create    | Create Folder |
|          | Delete    | Delete Folder |
|          | Share     | Share Folder  |

\*\*Google Drive use drive.file scope, only support file created from DMflow\.chat


# OpenAI

### Action

| Resource | Operation    | Description |
| -------- | ------------ | ----------- |
| Chat     | Complete     |             |
| Image    | Create       |             |
| Audio    | Speech       |             |
|          | Translations |             |


# SendGrid

### Action

| Resource | Operation | Description |
| -------- | --------- | ----------- |
| Mail     | Send      | Send        |


# Telegram

### Action

| Resource | Operation    | Description |
| -------- | ------------ | ----------- |
| Message  | Send Message |             |
|          | Send Photo   |             |
|          | Send Audio   |             |
|          | Send Video   |             |


# Form

DMflow\.chat forms offer many components and allow interactive dialogue with the form.

#### Form Components

**Creating Custom Forms**

* **Text Field**: Text input.
* **Tags**: Can store multiple contents in one field.
* **Textarea**: Displays as Markdown.
* **Checkbox**: Suitable for true/false values.
* **Radio**: Suitable for single choice values.
* **DateTime**: Allows date and time selection.
* **Date**: Allows date selection.
* **Select**: Can be multi-select or single-select. Select can integrate fields from other forms and monitor other select values for changes. The monitored select must be below the monitoring select.
* **Email**: Validates if it is an email. Text Field can also be used with regex for the same purpose.
* **Upload**: File upload, currently only supported in general form filling.
* **Number**: Validates if it is a number. Text Field can also be used with regex for the same purpose.
* **Password**: Can use Utils for encryption and comparison.
* **Hidden**: Can hold field values, divided into constants (fixed value), page (value obtained from the linked field), and session (currently only supports userId).
* **Reserve**: Includes keywords, start time, and end time. The start and end times must be on the same day.
* **Paragraph**: Outputs as a text message in the chat system.

**Form Permissions**

Forms can be accessed by visitors and users with permissions such as create, read, update, and delete.

* **Visitors**: Often from LINE, Messenger, or Telegram, can add data through conversations, usually granted add and read permissions.
* **Users**: Linked to a DMflow account via LINE, Messenger, or Telegram can use it.

**Form Functions**

* **Required**: Mandatory fields.
* **Options**: Must meet the values inside.
* **Max and Min Values**: For time and numbers.
* **Regex**: For text validation.

By following these guidelines, you can effectively use DMflow\.chat to manage various types of Q\&A and improve your chatbot's capabilities.


# Live Chat

DMflow\.chat supports live customer service and integrates LINE notify notifications with form trigger content. Features include assigned and unassigned Inbox management.

DMflow\.chat provides live customer support that can be managed via third-party channels, with Agents representing customer service personnel. There are two modes of live customer support:

1. **Through DMflow Web Interface**:
   * DMflow offers responses via its web interface for LINE, Messenger, and Telegram channels.
2. **Directed to Official Messenger or LINE Customer Centers**:
   * The official LINE customer center offers more functionalities than the API, such as phone calls and file transfers, which the API cannot handle. Mixed usage is possible.

#### Current Features

* DMflow's web interface supports LINE, Messenger, and Telegram customer service.
* Notifications are bound to LINE notify and are integrated based on form triggers.
* Agents can manage their inboxes, whether assigned or unassigned.
* Notes can be made using `/note` to mention other users.

#### Contact Management

* **Contact Inbox**: Allows Agents and tenant creators to directly contact DMflow support.
* **User Attributes**: Modify memory templates, properties, and tags. These tags are not the same as Agent ticket tags.

#### Skills

Agents can use domain skills, such as document Q\&A and chit-chat, with responses generated using LLM stream. Forms can open a new window in "guest mode," allowing agents to access and respond to guest-created form data.

#### Limitations

* Currently, live customer support is not available for embedded web pages.


# Role

DMflow\.chat supports various user roles with specific permissions:

1. **Tenant Creator**: Has all permissions.
2. **System Administrator**: Similar to Tenant Creator but cannot use live customer support.
3. **Bot Editor**: Can use templates, resources, and processes.
4. **Bot Analyst**: Can view logs.
5. **Bot Tester**: Can test bots, usually paired with Bot Editor.
6. **Domain Manager**: Manages all domains.
7. **General User**: Can use the dashboard.
8. **Event Manager**: Can use bot push notifications.
9. **Chat Agent**: Can be assigned as a customer service representative.


# Dashboard

DMflow\.chat dashboard integrates forms, aligns permissions, and enables easy data management, boosting efficiency and analysis capabilities.

The dashboard provides access to all enabled forms, allowing you to utilize the form functionalities based on your permissions.

You can view all data accessible according to your permissions here.

**Features**

* **Adjust Fields:** Hide/show fields, change fields to files (share a 10-minute link with others), use formulas, and link forms.
* **Filtering:** Filter data based on values.
* **Sorting:** Sort data by updates or new rows, by time or numbers (text sorting not supported yet).
* **Grouping:** Group data by total, distinct count, sum, max, min, average. Keywords can group by keyword, numbers by range, dates by year/month/day.

**Linked Fields**

You can link fields with other forms.

#### Example Formula:

Currently, formulas include the following. Fields can only be used within the same row, not across rows.

* **IF Condition**:

```javascript
IF(!{{bool}}, 'go', 'stop') // If bool=false, go; otherwise, stop
```

* **ABS**:&#x20;

```
ABS({{value}}) //Absolute e.g. ABS(-9) output 9
```

* **MAX/MIN/SUM/AVERAGE**:

```
MAX({{price1}}, {{price2}}, {{price3}}) // Find the maximum value (at least two numbers)
MIN({{price1}}, {{price2}}, {{price3}}) // Find the minimum value (at least two numbers)
SUM({{price1}}, {{price2}}, {{price3}}) // Sum of values (at least two numbers)
AVERAGE({{price1}}, {{price2}}, {{price3}}) // Average of values (at least two numbers)
```

* **SQRT**:

```
SQRT({{value}}) // Square root
```

* **RAND**:

```
RAND() // Output a number between 0 (inclusive) and 1 (exclusive)
```

* **Logical and Arithmetic Operators**:

```
+, -, *, /, >, =, <, ^ // Addition, subtraction, multiplication, division, greater than, equal to, less than, exponentiation
```

* **Mathematical Operations**:

```javascript
{{price}} * {{quantity}}
```

* **Date Operations**:

```javascript
DATETIME_DIFF('day', {{start}}, {{end}}) // Days between start and end
DATETIME_FORMAT({{start}}, 'yyyy-MM-dd') // Formats date
TODAY() // Today's date
WEEKDAY({{start}}) // Day of the week (1=Monday, 7=Sunday)
DAY({{start}}) // Day of the month
MONTH({{start}}) // Month
YEAR({{start}}) // Year
```


# Introduction

DMflow\.chat is a powerful platform for building smart chatbots. Create personalized conversations easily with intuitive graphical design.

#### Memory Templates

1. **User Parameters**: Store text, numbers, time (in seconds).
2. **User Tags**: Add tags for push notifications.
3. **Bot Parameters**: Fixed parameters similar to environment variables, typically used for resource keys.
4. **Single Session Storage**: Store text, numbers, time (in seconds), lists. Each chat session lasts 30 minutes and extends if the conversation continues, expiring 30 minutes after the conversation ends.

#### Scene

Scene allow for multiple conversation threads, useful for different scenes in Messenger or web-embedded scenarios.

#### Domain Invocation

Domains must be connected to the bot and published in production to be invoked. Error codes include:

* `10001`: Domain may have been deleted or not found.
* `10002`: Domain has been closed.
* `11000`: Unknown error occurred.

#### Resource Invocation

Direct HTTP calls are supported with a maximum connection time of 5 seconds. Avoid using this for connections that may time out.

#### Process Nodes

Graphical process design includes five node types:

1. **Resource Node**: For invoking resources.
2. **Reply Node**: For user responses.
3. **Scene Node**: (Discussed in the next chapter)
4. **Variable Node**: Write parameters into user parameters, tags, or single session storage.
5. **Invoke Node**: For invoking any service (discussed in the next chapter).

#### Publishing

Supports multiple versions with two branches per bot: dev (development) and prod (production).


# Bot Flow

DMflow\.chat: Intuitive design for smart chatbots. Supports multiple channels, customizes interactions, and improves communication efficiency.

**Graphical Node Introduction**

**Messaging Process Features**

* **Node Movement:** Nodes can be moved by dragging.
* **Testing:** Test third-party channels directly without switching to the channel each time.
* **Test and Production Versions:** All channels offer both test and production versions, except the web channel which only has a production version.

**Testing Interface**

<table><thead><tr><th>Channel</th><th data-type="checkbox">Card Template</th><th data-type="checkbox">Text Message</th><th data-type="checkbox">Image Message</th><th data-type="checkbox">Video Message</th><th data-type="checkbox">Voice Message</th><th data-type="checkbox">File Message</th></tr></thead><tbody><tr><td>Web</td><td>true</td><td>true</td><td>true</td><td>false</td><td>false</td><td>false</td></tr><tr><td>LINE</td><td>true</td><td>true</td><td>true</td><td>true</td><td>true</td><td>false</td></tr><tr><td>Messenger</td><td>true</td><td>true</td><td>true</td><td>true</td><td>true</td><td>true</td></tr><tr><td>Telegram</td><td>true</td><td>true</td><td>true</td><td>true</td><td>true</td><td>true</td></tr></tbody></table>

{% hint style="info" %}
Telegram does not support multiple card templates.

The bot can only output text with buttons; other formats require custom JSON output, including LINE's Flex Message.

(As of version 1.0.9, variable injection is not implemented and only fixed JSON output can be used.)

For more details, refer to this [documentation link](https://docs.communeify.com/tw/products/dmflow/tutorials/docs/bot-template.html).
{% endhint %}

{% hint style="warning" %}

**Pre-development Notes for Bots**

* **Start Node:** The start node is not necessarily the welcome node and can be called with /start.
* **Reply Node Interruption:** Initially included intent judgment within conditional statements, but intent has been removed in the cloud version, reducing its effectiveness. This feature now redirects to branches that satisfy conditions if the node falls back.
* **Using "/" Commands:** Scenarios can be directly jumped to with commands starting with "/". For example, from scenario A, if the bot asks "your message" and you type /B for information, after completing /B, it returns to scenario A and reasks "your message". Jumping to another node does not cancel the current node.
  {% endhint %}

**Resource Node**

The resource node can invoke other APIs and return results based on the conversation entity. It is synchronous by default, waiting for a response before proceeding. The timeout for this node is five seconds. Future versions will allow unlimited internal API calls.

**Reply Node**

Can output in different languages based on the user's chosen language (manual translation is preferred for accuracy).

| Content      | Explanation                                                      |
| ------------ | ---------------------------------------------------------------- |
| Answer       | Multiple answers can be chosen randomly.                         |
| Buttons      | Display text and click actions (text, event, link).              |
| Text Button  | Returns text on click.                                           |
| Link Button  | Opens a link on click.                                           |
| Event Button | Triggers various actions: ignore, interrupt, start, end, awaken. |

| Event Types     | Explanation                                                                        |
| --------------- | ---------------------------------------------------------------------------------- |
| Ignore Event    | Displays text only; the event is ignored by DMflow.                                |
| Interrupt Event | Jumps to another scene.                                                            |
| Start Event     | Returns to the main scene.                                                         |
| End Event       | Ends the session.                                                                  |
| Awaken Event    | In listening mode, this button awakens the bot without needing a wake-up sentence. |

| Interaction Type     | Explanation                                                  |
| -------------------- | ------------------------------------------------------------ |
| Await User Response  | Ends the node and waits for the user's reply.                |
| Interrupt Activation | Restarts from the beginning if the next node fails to match. |

**Scenario Node**

| Content        | Explanation                                                                                                                                                                                                         |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Interrupt      | Pauses the current scene and calls another; resumes the original scene after completion.                                                                                                                            |
| Restart        | Restarts the scene process.                                                                                                                                                                                         |
| Return to Main | Returns to the main scene.                                                                                                                                                                                          |
| Complete       | Automatically called upon node completion, except in branch fallbacks. To avoid fallback messages, follow with a complete node.                                                                                     |
| End Process    | Directly ends the process.                                                                                                                                                                                          |
| Listen         | The bot only receives messages; if a message matches a sub-process, it continues until a wake-up sentence is heard. Sub-processes often use resource nodes, enabling cross-channel chatting or resource monitoring. |
| Jump           | Directly jumps to another reply node (must check "await user response").                                                                                                                                            |

**Call Nodes**

These nodes are mostly API calls provided by the product. Currently available options include:

* Domain Call
* Event Registration (broadcast registration)
* Event Registration Cancellation (broadcast cancellation)
* Account Linking (link accounts to DMflow\.chat)
* Live Support

**Variable Nodes**

These nodes inject parameters into labels, user data, and single-session storage.


# Broadcasting

DMflow\.chat offers smart broadcasting with tag filtering and subscriptions. Boosts engagement and conversions through personalized communication and targeted marketing.

#### Filters

Messages are sent based on tag filters.

#### Self-Registration

When invoking the registration node, channel users are asked to subscribe before sending messages.


# Bot Statistics

DMflow\.chat's smart analytics dashboard tracks key metrics: users, activity, and messages. Analyzes conversation rounds to optimize interactions, helping improve user experience and conversion rates.

#### Dashboard Metrics

* **Total Users**: Total user count to date.
* **New Users**: New users within a selected period.
* **Active Users**: Users who replied within a selected period.
* **Total User Messages**: Total conversation count within a selected period and channel.
* **Scene Selection**: Total conversation rounds and the number of times the waiting reply node was entered.

Note: Each conversation round generates a unique sessionID, recording the number of replies per sessionID.


# AI Agent

Currently, this feature is only available for web chat and WhatsApp. Each use consumes one AI credit.

This mode significantly reduces the workload of developing conversational Q\&A flows. For our web interface, we offer two modes:

* **Suggestion Mode:** The AI will not directly reply to visitors but will provide suggested search items in the chat.
* **Automatic Reply Mode:** The AI will directly answer the visitor's questions.

Regardless of the mode, a notification will be sent immediately to online customer service agents for the first question. Additionally, a notification will be sent when the intent is not matched. Assigned agents are automatically distributed based on an automatic load balancing system, considering open chat windows.

**Input:**

* **Web Page:** Supports text.
* **WhatsApp:** Supports text, images, and voice messages (approximately one minute in length, file size should generally not exceed 5MB).

**How to Use:**

First, navigate to the domain to enable the functions you need.

**Document Q\&amp;A:**

This is the simplest method. You upload files, but note that in sitemap mode, only static web pages will be captured. For single dynamic web page capture, the recent version has the crawler user-agent preset to DMflowBot, and it will crawl according to the rules of robots.txt. If you are using Cloudflare and have WAF (Web Application Firewall) enabled, please disable it or allow DMflowBot to crawl. Please crawl your own web pages.

<figure><img src="/files/sB7q3RWRXmIPt5RpGrHl" alt=""><figcaption></figcaption></figure>

**Form Q & A:**

A is like using a database. You set the schema first. However, because the product itself is an adapter (converting SQL to the system's search method), it does not operate on a real database, so there are no issues like SQL injection.&#x20;

Regarding permissions, insertion by an agent is allowed (if you insert from the dashboard without permission, it will fail), but query permissions must be set correctly. Please refer to [Form Permissions](https://docs-en.dmflow.chat/domain/formqa/form) for details.&#x20;

<figure><img src="/files/6EhjIpIfbVEjTEsVPtJd" alt=""><figcaption></figcaption></figure>

After designing, please go to the dashboard to add settings. When the robot adds data, it will change according to your settings. If you do not add settings, it will automatically set according to the fields.&#x20;

<figure><img src="/files/6lXIH4Nk1O2bisEhlez7" alt=""><figcaption></figcaption></figure>

After clicking "Add Settings," you can set default values, required fields, etc. Note that Upload currently only supports UI functions and does not support any chatbots. If you want to trigger a workflow after adding, please set it in Button. For detailed triggers, please refer to [https://www.dmflow.chat/en/blog/2024-dmflow-form-qa-tutorial-2](https://www.google.com/search?q=https://www.dmflow.chat/tw/blog/2024-dmflow-form-qa-tutorial-2) or [Triggers](https://docs-en.dmflow.chat/domain/formqa).

<figure><img src="/files/ehUIeVNTRg1mcPIgc9c9" alt=""><figcaption></figcaption></figure>

**Chat Character:**

Finally, go to the Chat Character settings. Please refer to Chat Character.

**Start Setting Up an Agent:**

Currently, agent settings are divided into precondition settings (filtering user information), intent settings, and response settings.&#x20;

Filtering user information is not yet available and is mainly used to determine the user's chat rounds and whether the user's information meets the requirements (e.g., whether the email has been verified after being entered).&#x20;

Intent settings are the main focus, and this tutorial will focus on this aspect.

<figure><img src="/files/UYC8ztXkIfhckYfTuetX" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/VORqELpa1yNzpLLAkRHD" alt=""><figcaption></figcaption></figure>

**Intents are primarily determined by descriptions.** Visitor information is currently preloaded, and memory modules or database calls may be added in the future to make intent judgment more accurate.

**"Allow Shortcuts"** means you can use "/" followed by a name and a space, and then the conversation, to skip intent recognition.

For example: /query information I want to ask what your company's unified business number is.

**Modes are divided into agent response and direct response.**

**Direct response** means that when the intent is recognized, the message you have set will be replied directly.

**Agent response** means selecting your chat character, and when the intent is hit, it will switch to that agent for response.

**"Default Open Tools"** means that tools must be called every time the agent is called.

**"Default Open Thinking"** means that the agent will think before calling tools.

**A point to note here is "thinking".**

When you enable "thinking", it is recommended that your prompts should not be role-playing like "What kind of role are you?" Instead, write what you want to do directly in the prompt. For example: "Before adding user data, you should first check if the user exists." This kind of command writing prompt is sufficient.

**Testing**

Go to Settings -> Embed Webpage settings. Pay attention to the following: enable "Share Open", enable "Enable Embed Webpage Open", and add "<https://app.dmflow.chat>" to "Domain Restriction". After adding, open the share link below to test.

<figure><img src="/files/JotJMWAcPtlAJ7tQMgna" alt=""><figcaption></figcaption></figure>

**Each AI conversation will provide the full content of "thinking", automatic expansion of "knowledge" queries, and "followup\_questions" to recommend the user's next conversation steps.** Other features include the ability to display insertion messages for form insertions, and form searches will display the form content that the visitor can query (currently, expressions like "not equal to" are not supported). Clicking "More" will give you a direct view.

**Next to the visitor, there is a magic wand that can translate the language according to the language selected by your browser.** The conversation menu from left to right includes emoji, note (add shared notes, use @ to call other specialists), and magic (currently only provides translation functions, and if the other party's locale has a value, it will default to the other party's language).

**The free version of AI translation provides 10,000 characters per person per month, and the light version provides 100,000 characters per person per month.** Character count is limited by the number of input characters. This is sufficient for general customer service.


# Web

DMflow\.chat web: Flexible integration with customizable interfaces. Supports SDK, seamless system switching, and linking windows for unique user experiences.

**Web Version**

The web version offers customizable colors and tools to redirect to other websites.

**JavaScript SDK**

**Embed Window:**

```html
<script type="module">
  import Chatbot from "{{sdk url}}";
  Chatbot.init({"id":"{{bot id}}","theme":{"button":{"backgroundColor":"#9c27b0"},"header":{"backgroundColor":"#9c27b0"}}});
</script>
```

To use other chatbot brands or web support, use `observersConfig` to monitor user input. If "help" is detected, the chatbot is destroyed.

```json
{
	"id": "{{bot id}}",
	"theme": {
		"button": {
			"backgroundColor": "#9c27b0"
		},
		"header": {
			"backgroundColor": "#9c27b0"
		}
	},
	"observersConfig": {
		"observeUserInput": (userInput) => {
			if (userInput === 'help') {
				Chatbot.destroy()
			}
		}
	}
}
```

**Full Page:**

```html
<dmflow-fullchatbot id="{{bot id}}"></dmflow-fullchatbot>
<script type="module">
  import Chatbot from "{{sdk url}}";
  Chatbot.initFull({"id":"{{bot id}}");
</script>
```

**Sample Website**

{% embed url="<https://www.talkyon.com>" %}

**Link Window:**

&#x20;After enabling Share, obtain the encoded ID, e.g., @8aYK2AoGe0. Visit <https://app.dmflow.chat/s/\\{{id\\}}> to open the link window.

The link window supports logging in from the backend to continue the previous conversation.


# Instagram

DMflow\.chat: A unified chatbot platform integrating LINE, Messenger, Instagram, and Telegram to enhance customer reach and interaction efficiency.

The integration with Instagram is similar to [Messenger](/channel/messenger). If handling it yourself, you need to use the `instagram_manage_messages` permission, and ensure that Webhook options for `messages` and `messaging_postbacks` are selected.

**Comment Replies**

We support Instagram comment replies. For details, please refer to the comment reply section at the end of [Messenger](https://docs-en.dmflow.chat/channel/messenger) setup.


# Telegram

DMflow\.chat: A unified chatbot platform integrating LINE, Messenger, Instagram, and Telegram to enhance customer reach and interaction efficiency.

The integration with Telegram follows the steps outlined in the linked tutorial.

{% embed url="<https://docs.communeify.com/en/products/dmflow/tutorials/docs/telegram.html>" %}

## Apply for a Telegram bot <a href="#apply-for-a-telegram-bot" id="apply-for-a-telegram-bot"></a>

To create a new bot on Telegram, follow these steps:

* Open the Telegram app on your device.
* Search for the "BotFather" bot in the search bar.
* Start a chat with BotFather by clicking on it and then clicking the "Start" button.
* Type "/newbot" in the chat with BotFather to create a new bot.
* Follow the instructions provided by BotFather. It will ask you to provide a name for your bot (e.g., "MyNewBot") and a unique username for your bot (e.g., "@MyNewBot").
* Once you have provided the required information, BotFather will generate an API token for your bot. Make sure to keep this token secure as it is used to access the Telegram Bot API.
* Your new bot is now created. You can access and manage its settings through BotFather's chat or by using the generated API key to interact with the Telegram Bot API.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-001.jpg)

The token is covered by a red box in the image below. Please copy the token.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-002.jpg)

If you want to receive all messages in a group, you can follow these steps. By default, only messages starting with the command "/" are received.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-group-disabled-slash.jpg)

To configure your Telegram integration in the DmFlow system, select your bot, go to Settings -> Third-Party Integrations -> Telegram. Enter the numeric portion of the token before the colon (:) in the APP\_ID field, and enter the complete token "58XXXXXXXX:AAEXXXXXXXXXXEBXXXXXXX" in the token field. Select "Enable" and save. The system will verify if the provided information is correct.

![DmFlow integrate with Telegram](https://docs.communeify.com/images/en/telegram-setting-page.png)

## Setting Webhook <a href="#setting-webhook" id="setting-webhook"></a>

```awk
https://api.telegram.org/bot{{token}}/setWebhook
```

token replaced {{token}}

Body

```handlebars
{
    "url":"{{Webhook URL}}"
}
```

Webhook URL replaced {{Webhook URL}}

## Delete Webhook <a href="#delete-webhook" id="delete-webhook"></a>

```awk
https://api.telegram.org/bot{{token}}/deleteWebhook
```


# LINE

DMflow\.chat: A unified chatbot platform integrating LINE, Messenger, Instagram, and Telegram to enhance customer reach and interaction efficiency.

The integration with LINE follows the steps outlined in the linked tutorial.

{% embed url="<https://docs.communeify.com/en/products/dmflow/tutorials/docs/line.html>" %}

### Getting Started <a href="#getting-started" id="getting-started"></a>

First, you need to have a LINE account. Visit [LINE Business ID](https://account.line.biz/login)

![DmFlow integrate with LINE](https://docs.communeify.com/images/en/line-002.png)

#### Login with LINE Account

You can use your regular LINE user account to log in.

#### Login with Business Account

If you have a business email account, you can apply using that. Provide the account name, email address, company name, and business category (description of your business). After filling in the details, the application will be completed.

### Configuration

If the Messaging API is not enabled, go to Settings -> Messaging API and click on "Enable Messaging API". Enter the service provider name (you can name it as per your business; it can be changed later), and fill in the Privacy Policy URL and Terms of Use URL (optional). Confirm the details and click "OK".

![DmFlow integrate with LINE](https://docs.communeify.com/images/en/line-003.png)

* 1.Channel ID
* 2.Channel Secret
* 3.Fill in the Webhook URL.
* 4.Proceed to LINE Developers for the next steps.

#### LINE Developers

Clicking on the LINE Developers link will take you to [LINE Developers](https://developers.line.biz/en/). Follow the steps shown in the screenshots below.

![DmFlow integrate with LINE](https://docs.communeify.com/images/en/line-004.png)

![DmFlow integrate with LINE](https://docs.communeify.com/images/en/line-005.png)

![DmFlow integrate with LINE](https://docs.communeify.com/images/en/line-006.png)

![DmFlow integrate with LINE](https://docs.communeify.com/images/en/line-007.png)

You will obtain the Channel ID, Channel Secret, and Channel Access Token. Fill in the Webhook URL, and you are done.


# Messenger

DMflow\.chat: A unified chatbot platform integrating LINE, Messenger, Instagram, and Telegram to enhance customer reach and interaction efficiency.

Messenger integration can be done via Facebook OAuth2 to manage fan pages **(pending verification)**. Upon successful verification, it will be accessible. Alternatively, you can directly operate by filling in `APP_ID`, `APP_SECRET`, `PAGE_ID`, `VERIFY_TOKEN`, and `ACCESS_PAGE_TOKEN`.

The following links provide instructions similar to the old Facebook guide. This is a supplement if you pass the APP REVIEW:

**Links:**

* [Facebook Graph API Get Started](https://developers.facebook.com/docs/graph-api/get-started/)
* [Graph API Explorer](https://developers.facebook.com/tools/explorer)

**Steps:**

1. Switch App mode from Development to LIVE and add test user accounts.
2. Provide a reason for needing `pages_messaging` permission.
3. Supply test account details. Note that only real accounts with 2FA can be used.

Example message for requesting `pages_messaging` permission:

```vbnet
I'm building a chatbot with the Messenger Platform that will automatically answer people's questions about our services. To make the chatbot accessible to all Facebook users, I need the "pages_messaging" permission. We'll provide the test account details below. We ensure the chatbot is thoroughly tested and functions well with our Tester and Developer accounts. Thank you.
```

Test account details:

```lua
Email: ---example@gmail.com
Password: ---
```

Instructions to test integration:

```vbnet
1. Go to my Facebook page: m.me/{{page_id}}
2. Log in to Facebook with the tester account:
   + Email: ---example@gmail.com
   + Password: ---
3. Test my chatbot.
```

**Differences between Managed and Self-Managed:**

* **Managed:** Quickly links the chatbot but requires reauthorization if there are password changes or permission issues.
* **Self-Managed:** DMflow\.chat may provide a local installation version. You can perform functions not provided by DMflow\.chat using your Page access token, such as `account_link` or `thread_control`. The product is not limited to a single channel; for example, you can send messages from Messenger to Telegram.

**Managed**

* Pros: Quick bot connection
* Cons: The bot will require reauthorization if you change your password or if there are issues with your permissions.

Click 'Manage' -> 'Settings' -> 'Facebook' to obtain the link to connect your Facebook fan page. After obtaining the link, select your fan page to complete the process.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FQgfJYV0m3nX747ECOmh2%252Fd089a89f-446a-4800-a7f3-fa06c1f47aa1.png%3Falt%3Dmedia%26token%3Dbb5d2dea-21f5-45b1-acf9-07ab720b90ff&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=63fc17de&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Connect the bot

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FOdLCW8iUOlygoxyIXGM0%252FImage%252022.png%3Falt%3Dmedia%26token%3Dadc5560c-cf69-4c11-a7f1-c7bd5bc7bfe1&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=ef6f60fe&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Open Facebook Messages.

Click 'Bot' -> select your bot -> 'Settings' -> 'Facebook Messenger Settings' -> 'Start Hosted Mode' -> 'Enable and Save'. Now you can receive Facebook messages. You can also set up Facebook comment replies.

**Comment Replies**

We support Facebook/Instagram comment reply functionality. Currently, the system supports 200 operations per hour (comment replies, private messages, and hiding/deleting). The 200 operations refer to 200 real-time executions; **if the hourly limit exceeds 200, the executions will be non-real-time (but will still be completed)**.

Reply to First-Level Professional Account Comments' means that your own account's first-level comments will also be replied to. This feature is primarily for testing purposes.

If there are many comments, it's recommended to use multiple sets of different replies or to use private message replies only. **Private message replies are significantly more important than comment replies.**


# Whatsapp

The current version requires you to register your product manually.

First, go to 'Add Product' settings for WhatsApp, and then follow the steps below.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FdQT0bGTnjMlaDCf29fQh%252Fimage.png%3Falt%3Dmedia%26token%3D9d4c3342-9a50-43b8-8395-c61c3781d491&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=8e001034&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Go to 'development' to create WhatsApp.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FqA7QUCkYhnOY98Nzegnh%252Fimage.png%3Falt%3Dmedia%26token%3D62584cf6-c51e-480a-860f-e6944923ba65&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=d034348e&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252F8OXSDhzFCfkgFMU40JGV%252Fimage.png%3Falt%3Dmedia%26token%3D44d5688e-5174-4c78-9886-ece1ba2d3059&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=65e6317a&#x26;sv=2" alt=""><figcaption></figcaption></figure>

For testing, you can use a test phone number. Please note that the test phone number must be the recipient's phone number for the user to receive messages. Also, record the phone number code and the WhatsApp Business account number.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FvFe2zSf4ZASiYkeVT8jD%252Fimage.png%3Falt%3Dmedia%26token%3D49281440-6546-4c36-be07-5f48cbbd4ceb&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=a5edd81d&#x26;sv=2" alt=""><figcaption></figcaption></figure>

The access token above is temporary and will expire in approximately 24 hours. The following tutorial will show you how to obtain a permanent access token.

Go to <https://business.facebook.com/settings>, and then find 'System users' and click on it."

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FtQWwr4EDpSXGpay0MeAH%252Fimage.png%3Falt%3Dmedia%26token%3D0d582368-d095-49a2-83ac-4c673070bb6f&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=4e8246e2&#x26;sv=2" alt=""><figcaption></figcaption></figure>

On the user side, select 'System Users' and click 'Add'.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FAirSAmD0cvQIAyj4Wrcl%252Fimage.png%3Falt%3Dmedia%26token%3D147e2934-b260-44ad-8cfb-70f2775ae8b1&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=fe173e52&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Enter a username and select either 'admin' or 'employee' for the role.\
Click 'Assign assets'.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FcXQZzhBd5B0Gw4HY7kmx%252Fimage.png%3Falt%3Dmedia%26token%3Debd57948-a29a-49a1-9eae-b9cfbef27e2d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=6f8b8ee6&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Select the app you want, and set 'Full control' to 'Manage app'."

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FUVM6Qs4ZxGvE2bWYQUuZ%252Fimage.png%3Falt%3Dmedia%26token%3Dc5c7850f-306c-49b6-9996-ff01f171d230&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=62928e3d&#x26;sv=2" alt=""><figcaption></figcaption></figure>

After completing the addition, click 'Generate New Token' to finish.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FI6cpCEQgH4phyegVsKze%252Fimage.png%3Falt%3Dmedia%26token%3D474c4e39-b6df-4859-8f0f-801124c04fc3&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=12366140&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FJ4BU51JgPVJauqyEAvXB%252Fimage.png%3Falt%3Dmedia%26token%3Daa34bd10-fc88-4747-866b-1535062d65b1&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=8e2affdf&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FRsamqMnSHTIcDLoFr9on%252Fimage.png%3Falt%3Dmedia%26token%3Da84270de-b4fd-4cfc-8c7a-776923ae7e7d&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=f770f810&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FZXwHEilu7sjm7e13pOCF%252Fimage.png%3Falt%3Dmedia%26token%3D721b0d24-f104-4adb-b7ef-a9eb2c024b91&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=2ed6374b&#x26;sv=2" alt=""><figcaption></figcaption></figure>

Place the obtained Token into \[6] in the image below. Fill in the WhatsApp Business account number obtained earlier in \[1], the phone number code in \[2]. \[3] and \[4] can refer to the non-hosted section of Facebook, used to verify if it's from the WhatsApp payload. \[5] is where you can set your own verification code, the more complex, the better. And you're done.

<figure><img src="https://docs.dmflow.chat/~gitbook/image?url=https%3A%2F%2F3496017944-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FQmub5EsobLbLj4OPaUUl%252Fuploads%252FSMhC3qunPVAeHeHbsgX4%252Fimage.png%3Falt%3Dmedia%26token%3D2b930dc5-e081-420a-9b83-eb6faf02c8d6&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=6886334d&#x26;sv=2" alt=""><figcaption></figcaption></figure>


# API

The API functionality is similar to the one described in the provided link.

{% embed url="<https://docs.communeify.com/en/products/dmflow/tutorials/docs/bot-restapi.html>" %}

After generating an API key, copy it and include it in the header's `Authorization` field as `'Bearer ' + {{token}}`. Note that the key will be inaccessible after 15 minutes.

**API Endpoints:**

**1. Query Forms:**

* **URL:** `POST /_api/v1/formqa/search`
* **Header:** `Authorization: {{auth}}`
* **Request JSON:**

  ```json
  {
    "id": "",
    "tableId": "",
    "index": 0,
    "onlyReturnCount": false,
    "wheres": [{
        "name": "",
        "compare": "",
        "value": ""
      }
    ]
  }
  ```

<table><thead><tr><th width="138">REQUEST_PATH</th><th data-type="checkbox">Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>false</td><td>string</td><td>Primary ID</td></tr><tr><td>tableId</td><td>true</td><td>string</td><td>Table ID</td></tr><tr><td>index</td><td>true</td><td>number</td><td>Page Index</td></tr><tr><td>onlyReturnCount</td><td>false</td><td>boolean</td><td>Only response count, it's quickly.</td></tr><tr><td>wheres</td><td>false</td><td>array</td><td>conditions</td></tr><tr><td>wheres[0].name</td><td>true</td><td>string</td><td>Field Key</td></tr><tr><td>wheres[0].compare</td><td>true</td><td>enum</td><td>eq(Keyword use eq same as in), gt, lt, lte, gte</td></tr><tr><td>wheres[0].value</td><td>true</td><td>string</td><td>If It is date field(use seconds), number field use number.</td></tr></tbody></table>

We will support order and size in the future, default size is 20.

RESPONSE JSON

```
{
	"rc" : 0
	"error": "",
	"data": {
		"total_element": 0,
		"docs": []
	}
}
```

2. **Form Trigger Action**

* **URL:** `POST /_api/v1/formqa/action`
* **Header:**`Authorization: {{auth}}`

This API allows you to trigger actions based on form data. It has a rate limit of 100 executions per hour per trigger, including loop iterations. If the limit is reached, the API will still execute the final iteration in full, rather than stopping partway through.

**Request JSON:**

```json
{
  "parameters": {
    "product": "Product name",
    "price": 200,
    "quantity": 5
  },
  "triggerId": "",
  "tableId": "",
  "guestId": ""
}
```

<table><thead><tr><th>REQUEST_PATH</th><th data-type="checkbox">Required</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>parameters</td><td>true</td><td>object</td><td><p>{</p><p>"product": "Product",</p><p>"price": 200,</p><p>"quantity": 5</p><p>}</p></td></tr><tr><td>triggerId</td><td>true</td><td>string</td><td>Trigger ID</td></tr><tr><td>tableId</td><td>true</td><td>string</td><td>Form ID</td></tr><tr><td>guestId</td><td>false</td><td>string</td><td>Guest User ID</td></tr></tbody></table>

**Response JSON:**

```json
{
  "rc": 0,
  "error": "",
  "data": {
    "error": false,
    "success": true,
    "response": ""
  }
}
```

* **rc (number):** Return code. Non-zero values indicate an error.
* **error (string):** Description of the error if `rc` is non-zero.
* **data (object):** Contains the result of the action.
  * `error (boolean):` Indicates if the trigger encountered an error.
  * `success (boolean):` Indicates if the trigger successfully reached the END node.
  * `response (string):` Contains any additional response data.

#### Notes:

* **Initialization Time:** The server starts on-demand. The first API call may take some time, but subsequent calls will have normal response times.

**Deprecated Endpoint:** `/api/v1/bot/chat` is no longer in use.


# Latest

**2025-04-02**

* Added SendGrid Node.js ASM (Advanced Suppression Manager) feature.
* Changed Telegram `sendMessage` input from string to textarea (UI change).
* Increased the number of trigger background nodes from 10 to 20.
* Fixed issue where changing third-party registration to not require email verification prevented welcome emails from being sent.

**2025-04-01**

* Changed visitor removal to asynchronous processing.
* Added UTM parameters (`utm_source=dmflow.chat&utm_medium=chat&utm_campaign=general`) to some output links.
* For WhatsApp, automatically query locale if the input is a phone number.
* Fixed Telegram `reply_markup` issue.
* Added thinking phase to the output validation process.
* Fixed UI text for the Lite plan, changing "two users" to "three users".
* Added pagination feature for Document Q\&A.
* Fixed issue where the trial version's 100 monthly AI points were partially granted if the trial expired and converted to the free plan.
* Added confirmation alert prompt before navigating to any clicked Markdown link.

**2025-03-28**

* Updated UI loading indicator graphic.
* Login now shows specific error messages on verification failure, instead of an "unknown error".
* Updated agent SVG icon with an improved design.
* Fixed bug where old sitemaps wouldn't display if the page filtering feature hadn't been used previously.
* Added user information display to the Resource Header.
* Added AI Magic feature, currently supporting translation up to 10,000 characters (Free/Trial) and 100,000 characters (Lite Plan).
* Added refresh function to the web chat interface.
* Added sender name display for Telegram/LINE group messages (LINE uses ID converted to Visitor-number).

**2025-03-25**

* Simplified registration flow: third-party logins will no longer require email verification.
* Added 'category' field to the Form Q\&A UI.
* Set incoming traffic size limit for Trigger Webhook payload to 1MB.
* Fixed bug where selecting an AI-suggested Document Q\&A did not display it in the UI.

**2025-03-19**

* Added WhatsApp widgets.
* Web chat transfers to live agents will no longer be subject to traffic control limits.
* Visitors will be notified upon transfer to a live agent, and also when transferred back to the bot.
* Released version 1.0.51.

**2025-03-18**

* Merged WhatsApp branch into the main codebase.

**2025-03-16**

* After transferring to an agent, the LINE `replyToken` will be saved each time to allow the agent to send messages without needing to call the push API repeatedly.

**2025-03-15**

* Fixed issue where agents were not notified if an intent was not matched (now, if intent isn't matched initially and the visitor sends a message, two notifications might be sent simultaneously).

**2025-03-13**

* Split the 'language' field in web chat visitor information into 'country' and 'language'.
* Reduced the form limit for Free/Trial plans to 1000.

**2025-03-11**

* Added feature allowing agents to modify their public-facing nickname.
* Added check in lead forms to see if the form has already been filled out.
* Removed fingerprinting feature.

**2025-03-11 (Second Entry)**

* Implemented periodic deletion of bot logs older than 90 days.
* Released version 1.0.50.

**2025-03-10**

* Added group functionality to `human_agent_help`.
* Added visitor offline and online status indicators to web chat.

**2025-03-07**

* Added AI suggestions and waiting prompts to web chat.

**2025-02-24**

* Added Thinking Mode feature.

**2025-02-20**

* Added Document Evaluation feature.

**2025-02-19**

* Removed chat functionality from the Form Q\&A feature.
* Fixed issue where the admin knowledge base filter code only searched its own entries.
* Added "Appointment Lookup" tool to Chit-chat features.
* Removed LINE Notify integration.

**2025-02-18**

* Document Q\&A API now includes document status (status is checked on each crawl; only one crawl API call allowed at a time).
* Removed multi-language functionality for bots and domains (simplification).
* Added automatic data extraction feature for image-based PDFs and audio files.
* Fixed issue where calling the memory storage function did not deduct AI points.
* Fixed issue where data could not be found if the Domain `SessionId` was empty.

**2025-02-07**

* Updated to Gemini 2.0.
* Added advanced features for Document Q\&A.
* Added `response_format` support for OpenAI and OpenRouter.

**2025-02-02**

* Removed daily free quota; changed to a one-time quota grant.
* Modified the counting method: changed from counting conversation turns to counting sessions (a session is automatically extended if there's activity within 30 minutes).

**2025-01-27**

* Changed crawler user-agent to `DMflowBot` (will no longer mimic real users; please add an exclusion for this user-agent if using Cloudflare).
* Added automatic JSON parsing repair feature (attempts to fix malformed JSON output from LLMs).
* Added Product Preview version.

**2025-01-22**

* Removed the button allowing users on the Free plan to switch to the Trial plan.
* In the Start node, logs will not be recorded if the bot is not awakened (i.e., no conversation logs if the bot isn't triggered).

**2025-01-19**

* Set limits for Chit-chat role descriptions based on CJK character count, allowing for longer English descriptions.

**2025-01-17**

* Increased the payload limit for resource retrieval from 1KB to 16KB.
* Added automatic character truncation for Trigger nodes (LINE and Telegram) to prevent sending failures.

**2025-01-14**

* Fixed error where LINE button labels were not automatically truncated to 20 characters.

**2025-01-12**

* Auto-reply comments now display the number of times they have been triggered.
* Added rule: Each added user increases the attachment storage limit by 1GB.
* The `human_agent_help` tool now automatically provides feedback to the agent.

**2025-01-10**

* In web chat, clicking the 'dislike' (thumbs down) button will now prompt the user for feedback.

**2025-01-08**

* Added resource usage (custom API) capability to Chit-chat roles.
* Reduced attachment storage limit for Free/Trial versions to 100MB.
* Implemented load balancing for agent assignment, automatically distributing based on the number of cases handled.
* Added `Loops done` trigger, called when a Loops node finishes execution.
* Added a time limit for background processes, defaulting to five minutes.
* Enabled the use of custom OpenAI configurations.
* Released version 1.0.49.

**2025-01-04**

* Disabled API usage for the Free version.
* Added session count limits.
* Released version 1.0.48.

**2024-12-31**

* Added welcome messages with buttons for Chit-chat roles.
* Released version 1.0.47.

**2024-12-20**

* Released version 1.0.46.

**2024-12-18**

* Added custom fields to the web lead form.
* Released version 1.0.45.

**2024-12-17**

* Integrated Google Routes API into the Chit-chat tool.
* Added functionality to generate domain secret keys.
* Added hourly scheduling option to Workflow triggers.

**2024-12-15**

* Added upload API for Document Q\&A.
* Disabled the 'retrain' button for Document Q\&A.
* Added Workflow triggers and Webhooks.

**2024-12-12**

* Added Memory Module for storing additional visitor-specific information.
* Added Messenger tag support for messages sent by agents.

**2024-12-08**

* Made document index content visible.
* Added messages related to document caching.

**2024-12-07**

* Split attachments: Bot, Domain, and Form attachments are no longer shared publicly across different entities.
* Fixed issue where forms could store NULL values.

**2024-12-06**

* Added filtering feature for Document Q\&A.

**2024-11-30**

* Reduced daily AI point grant for the Trial version from 50 to 20.
* Added company tax ID verification feature.
* Released version 1.0.44.

**2024-11-28**

* Fixed issue with parameter positioning in Resource nodes.
* Enhanced timezone handling for Chit-chat roles.

**2024-11-27**

* Accelerated the loading speed of the Resource node page.
* API endpoint `/bot/users/{cid}` now allows modification of creation and modification dates (using milliseconds) for debug channels.

**2024-11-26**

* API endpoint `/formqa/search` added `size` parameter (max 20, default 20).
* API endpoint `/formqa/search` response now includes a `success` parameter.

**2024-11-25**

* Bound public files to specific bots (currently, bots can still select files from other bots, but this will be restricted after bot isolation, allowing bots to only select their own public files).
* Bot flow Branch node: `conversation` prefix now supports greater than (>) and less than (<) comparisons (attempts numeric comparison first, otherwise uses string comparison).
* Bot flow Branch node: Target length increased from 52 to 255 characters.
* Bot flow Variable node: Can now modify parameters with the `conversation` prefix and provides a `replace` function.
* Bot memory template: Removed `list` functionality for `session` memory.
* In addition to `userId`, `id`, `username`, `email`, `phone`, visitors can now access `created_time` (creation time) and `updated_time` (last interaction time - modifying parameters doesn't affect this, only updated when visitor interacts with the bot).
* Web chat: Added a popup window option for sending messages.
* Released version 1.0.43.

**2024-11-22**

* Fixed issue where saving dashboard configurations to 'My Favorites' caused owner, last modified, and creation date information to disappear.

**2024-11-21**

* Fixed issue where the broadcast visitor list display used milliseconds instead of seconds for timestamps.
* Fixed issue in the broadcast frontend editor where channel, version, and options were not correctly disabled during modification.

**2024-11-20**

* Bot flow: Memory variables (`user`, `sys_user`, `session`, `conversation`) of string type now support regular expressions (regex).
* Increased regex pattern length limit from 52 to 255 characters.
* Parameters injected into `sys_user` by Resource nodes now include `email`, `username`, and `phone`.
* \[Fixed] Bug where transferring members from a group to an empty group failed to remove them from the original group.
* Optimized layout and appearance of the live support interface.
* Added "Agent Priority" feature.
  * Rule 1: First-time inquiries from visitors transferred to 'Blocked Users' will not trigger bot responses.
  * Rule 2: In web chat, if a user is blocked, the bot won't trigger, messages sent to live support won't be received, only the user record will be created.
  * Rule 3: For other channels, visitor messages will automatically route to the live support section. The user must be unblocked by support staff or authorized personnel before bot auto-replies can resume.
* Released version 1.0.42.

**2024-11-18**

* Added automatic message reply when no agents are online.

**2024-11-15**

* Web chats configured to open automatically will now block requests from user-agents containing 'bot'.
* If a non-existent scene is specified, the system will default to the 'Main' scene.
* Added `FullChatbot` and `PluginChatbot` types for web chat.
* Web chat `Chatbot` and `PluginChatbot` types now have a `popupWindow()` function to programmatically open the chat window (e.g., via a button click).
* Web chat `Chatbot`, `PluginChatbot`, and `FullChatbot` types now have a `sendMessage(text: string)` function.
* Added `observeSwitchLiveChat` function to trigger transfer to live support by monitoring an input text field.
* Added the following default parameters to web chat configuration:

  ```json
  {
    "theme": {
      "button": {
        "autoWindowOpen": {
          "autoOpen": true,
          "openDelay": 10,
          "autoOpenOnMobile": false
        }
      }
    }
  }
  ```

**2024-11-14**

* Knowledge Base entries now include 'Update Date', 'Creation Date', and 'Owner' fields. Owners can be added manually.
* Changed background images for login and registration screens.
* \[Fixed] Component tags now become read-only after being added.
* \[Fixed] Reduced maximum text length for Knowledge Base entries from 65536 to 16384 characters (dashboard change was already implemented).
* Released version 1.0.41.

**2024-11-12**

* Temporarily reduced the maximum selectable number of payment domains from ten to three.
* Chit-chat role tool: Added multi-select capability for form lists and form search results. Maximum number of tools per role limited to ten.
* Added notification indicating that the attribute feature cannot be used with contacts.
* Added coordinate lookup tool for Chit-chat roles.
* Released version 1.0.40.

**2024-11-11**

* \[Fixed] Corrected error message displayed when an already invited user attempts to register as a tenant owner.
* \[Fixed] LINE AI Q\&A was not showing the 'Helpful' and 'Unhelpful' quick reply buttons.
* Released version 1.0.39.

**2024-11-06**

* Fixed display issue where deleting resource permissions did not immediately refresh the UI.
* Fixed issue where quickly double-clicking a component could prevent it from closing.
* Document Q\&A: Added the ability to include a URL upon completion of the syntax/process.
* Chit-chat role tool `rate_conversation`: After a visitor marks an answer as helpful, an additional response can be provided (e.g., suggesting a link for rating/review).
* (Duplicate entry) Document Q\&A: Added the ability to include URLs upon syntax completion.

**2024-11-01**

* Added functionality in Bot Logs to transfer a conversation to live support. Requires both Agent and Bot Analyst permissions. (This is primarily intended as a solution for Instagram, where proactive messaging might trigger bot responses upon user reply).
* Released version 1.0.38.

**2024-10-31**

* Added new dashboard chart types: Line, Area, Bar, and Pie charts.
* Optimized the styling of the web chat carousel component.

**2024-10-28**

* Added filters to Bot Logs for 'new users within 30 days' and 'active users within 30 days'.
* Added Instagram 24-hour broadcast capability.
* \[Fixed] Issue with file download names in LINE.
* Added Haiku Dev version (internal, not yet released).
* Released version 1.0.37.

**2024-10-26**

* Removing a LINE Rich Menu now also removes all its previously published instances from the system, leaving no remnants.
* Added functionality in the frontend to copy the ID of a LINE Rich Menu.

**2024-10-25**

* \[Fixed] After updating a sitemap filter, the 'sync index' button is now disabled and becomes clickable again after one hour.

**2024-10-23**

* Added OpenTable integration allowing inserted forms to be shared.
* Added functionality to the role tool to insert form links.
* Released version 1.0.36.

**2024-10-20**

* Added Bank Transfer and PayPal as payment options.

**2024-10-18**

* Added array functionality (for automatic tagging) to the role tool.

**2024-10-13**

* Added LINE Rich Menu feature.
* Optimized appointment scheduling dialogue (excluding forms): now checks and provides available time slots to the user.
* Agent assignments within groups still allow the tenant owner to view all messages.
* To prevent interference, conversing in the Domain testing area or the Knowledge Base admin chat will now clear the context of the other.

**2024-10-11**

* Limited web chat input content to 1024 characters.
* \[Fixed] Issue with displaying weekends in appointment scheduling.

**2024-10-10**

* \[Fixed] Users could previously see menu items for permissions they didn't have (though unclickable); these are now hidden.
* \[Fixed] Issue where quickly clicking into the Knowledge Base before it finished loading caused problems; clicking is now enabled only after loading completes.
* Removed the previous method for uploading broadcast images; now uses the unified public image upload system.
* Provided a method for JSON injection for Facebook/Instagram comments.
* Released version 1.0.35.

**2024-10-09**

* Web crawler will no longer crawl pages disallowed by `robots.txt`.
* Added a 'Name' field to agent notes.
* Added Telegram notifications (intended to replace LINE Notify, which will be discontinued in March next year).

**2024-10-07**

* \[Fixed] Issue preventing the modification of the scene limit.

**2024-10-04**

* Added a confirmation dialog before initiating downloads from within tables.
* \[Fixed] Issue where modifying dashboard columns caused previously saved 'My Favorites' configurations to lose those columns. (Note: This might not be fully resolved; it's recommended to recreate favorites if columns used in them are added/deleted).
* Embedded web view: Added a copy function and optimized the layout of the source display.

**2024-10-03**

* Document Q\&A: Filters can now be recreated even after corrections have been made.

**2024-10-02**

* Added country flags next to language options in the Reply node.

**2024-10-01**

* Added a function to 'Block bot usage' for users, accessible within Bot Logs. Also added capabilities to modify tags and attributes (latter two not yet visible in UI).
* Added functionality to forcibly end domain interactions if they exceed the attempt limit.
* Released version 1.0.34.

**2024-09-30**

* Welcome messages will no longer stop after the first matching flow. If multiple flows match (e.g., one triggers after 5 seconds, another after 10 seconds), both welcome messages will be displayed.
* Document Q\&A entries cannot be deleted if their status is not 'ready' or if they were created less than one hour ago.

**2024-09-25**

* Markdown links outputted in web chat now default to using `target="_blank"` and `rel="nofollow"`.
* The button to close the embedded web view now disappears after being clicked, causing the entire embedded view to shift down by 80px.
* Added a small, scrollable toolbar at the top of the opened embedded web view, currently supporting quick links for phone/email/FB/IG/TG.
* Released version 1.0.32 and subsequently version 1.0.33 after significant internal architecture changes.

**2024-09-24**

* Updated frontend architecture.

**2024-09-22**

* Added Facebook/Instagram/Threads to Triggers (initially intended for comment handling, but this functionality is not yet fully implemented).
* Removed the list mapping functionality for OpenAI and OpenRouter integrations; they will no longer automatically include form history context.
* Released version 1.0.31.

**2024-09-18**

* Removed file storage for Document Q\&A; files uploaded for this feature will no longer be saved going forward.
* Improved the visual appearance of several pages.
* Web chat now displays phone numbers formatted according to the user's browser language settings.

**2024-09-17**

* \[Fixed] Issue where deleting an item from the welcome message list always removed the first item in the list.

**2024-09-15**

* Added application integrity check: If a login token is suspected stolen (e.g., by a colleague), the system compares signatures and sends a notification upon mismatch.
* Added broadcast title setting, primarily for use with Facebook One-Time Notification and Recurring Notifications.
* Made the embedded web view panel on the right side of the Web Settings page scroll along with the main page content.
* Added Tenant Groups feature.
* Added Tenant Description feature: Automatically inserts the current day of the week and online hours into the live chat description.
* Released version 1.0.30.

**2024-09-14**

* Added a Live Agent Notes list feature. Notes are displayed both within the conversation and in a right-side panel. Notes displayed within the conversation will be automatically deleted after 30 days.

**2024-09-12**

* Added an automatic prompt generation feature for Roles (compatible with Gemini and GPT). Prompts generated using `SYS_PROMPT` are limited to GPT.
* Added auto-comment keywords and a rule preventing successful matches from triggering further comments (prevents infinite comment loops even if keywords match).

**2024-09-11**

* Extended the maximum length for welcome messages from 64 to 128 characters.
* \[Fixed] Improved the display formatting of welcome messages.

**2024-09-09**

* Added Facebook/Instagram Persistent Menu and Get Started button features.
* Added an option for users whose subscription has expired to manually convert their account to the Free plan (currently available starting 2 days after expiration).

**2024-09-04**

* Added a 'Me' node within Triggers, allowing workflows to identify the current operator.
* Re-released new SVG icons for web chat with a unified format.

**2024-08-31**

* Live support can now be directly activated from the web chat options menu.
* Allowed web domain restrictions to use the `http` protocol (intended for local development environments only), in addition to `https`.
* Added web widgets for YouTube, Facebook, Threads, Github, and LinkedIn.

**2024-08-30**

* Added rules for handling text length limits across various platforms (e.g., automatically truncating text that exceeds limits in LINE templates).
* Added automatic deletion and hiding features for Facebook/Instagram replies.

**2024-08-28**

* Adapted numerous screens and interfaces for better support on mobile devices.
* Added tracking and display of the user's last logout time.
* Added error message notifications within the web chat interface if problems occur.

**2024-08-27**

* \[Fixed] Issue where the variable list was not appearing in the bot flow 'Call Node' configuration.
* \[Fixed] Issue where changing the `APP_ID` prevented live agents from accessing or reading user messages.

**2024-08-26**

* Added filtering options to the History Log based on the existence of email and phone numbers.
* Provided a CSV template download option for Document Q\&A conversation data.

**2024-08-25**

* Added support for email, phone, and language variables in Bot Flow nodes (Variable node, Branch node, Reply node), including autocomplete suggestions in the Reply node.
* Increased the maximum message length for the Reply node from 255 to 512 characters.

**2024-08-24**

* Added a 'Resend' button to the web chat interface, allowing users to resend messages easily in case of network issues without needing to retype.


# 1.0.17

Beta version

**Current Version: 1.0.17** (As of 2024-07-09)

**New Features:**

* Attachment limit reminder
* Default model updated from GPT 3.5 to Gemini 1.5 flash
* Fixed default sorting issue in forms
* Added support for Google Calendar and Google Drive (only available if created by DMflow\.chat)
* Calendar view optimization for mobile usage

**Previous Updates:**

**1.0.16 (2024-06-23):**

* Facebook and Instagram review updates (pending approval)
* Added global setting for unmapped hits (auto-adding button when FALLBACK is detected)

**1.0.15 (2024-06-22):**

* Added Instagram integration
* Added comment reply (under verification)

**1.0.14 (2024-06-12):**

* Added agent median and average completion time and first response time
* Displayed user blocking status

**1.0.13 (2024-06-11):**

* Added sound notifications
* System security updates

**1.0.12 (2024-06-07):**

* Added agent removal feature
* Added sharing feature with scene and lang parameters
* Fixed calendar bugs

**1.0.11 (2024-06-05):**

* Added QR code and URL sharing for bots
* Fixed widget front-end alert inconsistencies
* Improved document query to scrape sitemap URLs and title

**1.0.10 (2024-06-03):**

* Added potential customer form for web embedding (collects EMAIL, PHONE, and name)
* Added chat roles and skills for casual conversation
* Fixed document query click issues
* Improved document question AI capabilities
* Added simple calendar and card view to the dashboard
* Fixed unread count reset issue in live support

**1.0.9 (2024-05-27):**

* Fixed trigger JSON node extraction issues
* Added date formulas: DATETIME\_DIFF, DATETIME\_FORMAT, TODAY, WEEKDAY, etc.
* Improved form question AI
* Added dashboard preloading
* Added dashboard notifications for background trigger updates

**1.0.8 (2024-05-23):**

* Added Markdown preview
* Markdown textarea now opens in a new window
* Broadcast filters and user registration view
* Messenger welcome message mentions
* Added agent notifications and rest status
* Fixed domain setting save failures

**1.0.7 (2024-05-18):**

* Updated domain (app.dmflow\.chat)
* Fixed new user visitor list writing issues
* Added "Latest News" on the homepage
* Fixed bot process event registration bugs
* Added contact feature for system administrator dialogue
* Added system administrator user feature without user limit


