Automated Responses with DMflow Triggers
In DMflow.chat, triggers are crucial for automating responses by extracting slots. They are primarily categorized into two fields: Prompt and Response. This guide will help you understand how to use these triggers to perform actions such as uploading files from LINE to Google Drive, with a detailed explanation of setting up triggers, managing response flows, and configuring bot settings.
To begin, set up a resource to extract content from LINE messages. Use the following URL to obtain message content:
web url=api-data.line.me/v2/bot/message/{{messageId}}/content
Ensure the line_token parameter is configured in Settings -> Global Parameters with the LineChannelAccessToken, starting with Bearer ...
, and don’t forget to save your changes.
Next, address the missing slot, which is the messageId, in your response node. Open the graphical window without binding a form.
For detailed instructions on configuring triggers, check out the DmFlow documentation (Note: This guide is based on version 0.0.2).
Configuring Trigger Flow
The trigger flow involves an “if” node and a “Response” node. The ID for these nodes is randomly generated, so avoid copying it directly.
The “if” node configuration is as follows:
The “Response” node configuration (ID: c8408716-d184-4b3e-a14d-0150b831d6f3) should be set up with the following fields:
Fields: string
Field: messageId
Description: The ID of the message.
Multiple: False
Required: True
Fields: string
Field: filename
Description: The name of the file.
Multiple: False
Required: True
Prompt: If the message ID is obtained before the file name, ask the user to provide the file name.
Response: Please upload the file you want to upload.
If you need help with the Prompt, you can generate it using 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 Configuration
Complete the configuration as shown below and ensure the trigger is activated.
Bot Configuration
To test the bot, publish the domain as a production version and add the bot configuration. Make sure the “Start unmatched times” setting is enabled to avoid skipping nodes during testing due to failures.
Once configured, bind the bot to LINE and publish either the development or production version. The following images show the test results.