How to Use Responses with Triggers

Responses are equivalent to extracting slots, and they are divided into the following Fields: Prompt, and Response. In terms of usage, it follows the concept of Functions, and you need to add fields to extract slots.

Trigger - Response

In this example, we implement a simple scenario using LINE, a popular messaging platform in Taiwan, to upload a file to Google Drive (adjust HTTP accordingly for other platforms).

First, create a resource to extract the content of the LINE message. You can obtain it as follows. The parameter line_token can be set in Settings -> Global Parameters by adding LineChannelAccessToken starting with Bearer .... After adding, remember to click Save at the top.

web url=api-data.line.me/v2/bot/message/{{messageId}}/content

ADD LINE CONTENT

Once done, go back to the trigger. In the example above, we found that we are missing the slot, which is the messageId.

So, we need to add this slot in the response node. Choose not to bind a form and open the graphical window.

Follow the steps in the sequence of images below (a COPY function to duplicate the flowchart will be available in the future). For detailed instructions, you can visit the DmFlow documentation (Note: this tutorial is based on version 0.0.2).

Trigger Flow

Trigger Flow

The image includes an “if” and a “Response” node. The ID is randomly generated, and it is different each time, so do not copy it directly.

The configuration for “if” is as follows:

If

The configuration for “Response” (ID: c8408716-d184-4b3e-a14d-0150b831d6f3) is as follows:

Fields: string
Field: messageId
Description: This is the ID in the message.
Multiple: False
Required: True

Fields: string
Field: filename
Description: This is the file name.
Multiple: False
Required: True

Prompt: When extracting the message's ID and the file name from the attachment, if the message ID is obtained first, ask the user for the file name.

Response: Please upload the file you want to upload.

Note: If you are unsure how to fill in the Prompt, you can generate it by finding SYS_PROMPT in the chat domain.

English ver.
When extracting the message's ID and the file name from the attachment, if the message ID is obtained first, ask the user for the file name.

Chinese ver.
當收到一條消息時,提取消息的ID和附件的描述。當提取到消息的ID後,請詢問使用者需要什麼描述來作為檔案名稱。不要捏造。使用繁體中文回覆。

Background Flow

Background Flow

You can complete it based on the following configuration. After configuring, remember to activate this trigger.

Background Flow Details

Background Flow Setting

Bot Configuration

If you remember, you need to publish the previous domain as a production version and add a bot before you can query it in the bot configuration.

Pay attention to the “Start unmatched times” setting; if it is not enabled, during testing, if one failure occurs, it will directly skip that node.

After use, you can bind it to LINE and publish either the development or production version. The second image below shows the test result.

Bot Configuration

LINE