logo
Development
Search
Task

Task

Introduction

Task is the Agent's proactive messaging capability: the Agent initiates the conversation with the user instead of waiting for the user to speak first.

This differs from a regular conversation. A regular conversation is "the user asks → the Agent answers", whereas a task is "the platform sends a message to the Agent on the user's behalf according to the conditions you set → the Agent generates a reply → the reply is pushed to the user". The "trigger message" you fill in for a task is essentially a message sent to the Agent on behalf of the user. The Agent generates a reply just as it would for a real user message, and what the end user sees is the Agent's reply, not the trigger message itself.

Typical use cases:

Scenario Trigger type Example
Regular broadcast Active - Scheduled Push today's news to all Telegram users at 9:00 every morning
Re-engage inactive users Passive - User Triggered Proactively send a check-in message when a user has not chatted for more than 3 days
Business system integration Active - Event After an order ships, the business system calls the Webhook to notify the user of the shipping information
One-time notification Active - Scheduled (Once) Send an event notification at a specified time to users who were active in the past month

Prerequisites

  • Tasks are only sent to users who have already had a conversation with the Agent. For each user, the platform finds their "most recently active" conversation on the target channel and injects the message into that conversation. Users with no conversation history will not receive task messages (recorded as NO_CONVERSATION in the execution details).
  • If the target channel is a third-party integration (such as WhatsApp, Telegram, LINE, etc.), make sure the corresponding integration is correctly configured and enabled under "Integrations". A disabled integration or invalid credentials will cause delivery to fail (CHANNEL_CONFIG_INVALID / CHANNEL_AUTH_FAILED).
  • Task execution calls the Agent's LLM to generate a reply, and consumes Credits as usual.

Entry Point

Go to DevSpace → Agent → select an Agent → "Tasks" in the left menu.

The task list supports searching by task name and filtering by Status, Trigger, and Target. List fields:

Field Description
Name Task name
Status Task status, see Task Status
Trigger Trigger type: Scheduled / Event / User Triggered
Target Target users: All users / Custom users
Message Trigger message (template content)
Created Creation time and creator
Action Actions: View / Stop / Delete

Creating a Task

Click New task in the upper right corner and complete the configuration in the drawer on the right.

1. Basic Information

Setting Description
Task name Task name, required, up to 100 characters
Target users Target users, choose one: Custom users (default) or All users
Target channels Target channels, required when Custom users is selected, multiple selection allowed. Messages are only sent to users who have conversations on these channels
Target conversation scope Target conversation scope (start time – end time). Only users whose conversation creation time falls within this range will be targeted. Use it to limit delivery to "recently active" users

Note: Selecting All users will prompt a confirmation dialog, because it means broadcasting to all users on every channel of this Agent. Please make sure the target conversation scope is set appropriately to avoid sending messages by mistake.

Supported Target Channels

Category Channels
Owned channels Web, Share, Embed (iframe), Widget, App, API
Workspace Workspace, Workspace Apps
IM channels Telegram, WhatsApp (Meta), WhatsApp (Engagelab), LINE, Slack, Facebook Messenger, Instagram, WeChat Customer Service, Teams
Help desk platforms Intercom, LiveChat, Livedesk, OmniChat, Zoho SalesIQ

Tip: Some channels do not yet support server-side proactive push due to platform protocol restrictions (such as Discord, DingTalk, and SoBot). They are grayed out in the channel dropdown with the reason shown. For owned channels (Web / Widget, etc.), the reply is written directly into the conversation, and the user will see it the next time they open the chat window. For IM channels and help desk platforms, the reply is proactively pushed to the user through the corresponding platform's API.

2. Trigger

The trigger determines "when to send". There are three types:

Active - Scheduled

Initiated by the platform according to the schedule you set. Suitable for regular broadcasts and one-time notifications.

Recurrence Description
Daily Triggers every day at the specified time (HH:mm)
Weekly Triggers at the specified time on the specified day(s) of the week
Monthly Triggers at the specified time on the specified day of the month. If the month does not have that day (e.g. the 31st), the last day of the month is used
Interval Triggers at a fixed interval, in minutes / hours / days, with a minimum of 1 minute
Once Executes only once. The execution time must be at least 1 minute later than the current time and no more than 1 year ahead

Times are calculated in the time zone selected for the task. A scheduled task is in the WAITING state after creation and moves to RUNNING when the first execution time is reached. A Once task automatically changes to COMPLETED after it finishes executing.

Active - Event

Triggered by your business system calling the platform via a Webhook. Suitable for integration with business events such as orders, payments, and tickets.

When creating the task, select an authentication method and fill in the credentials. The platform automatically generates a unique Webhook URL (viewable in the task details after creation):

Setting Description
Auth method Authentication method: Basic Auth or HMAC signature
Username / Password Required in Basic Auth mode. Passed in the request as Authorization: Basic base64(username:password)
Secret Signing key in HMAC mode. The caller must compute an HMAC-SHA256 of the request body and pass it in the X-Signature: sha256=<hex> request header

Webhook Call Example

The Webhook URL has the form {platform domain}/bot/proactive-task/webhook/{webhookPath}. Always use the full address shown in the task details.

POST {Webhook URL} Content-Type: application/json Authorization: Basic base64(username:password) { "idempotency_key": "order-20260903-0001", "target": { "channel": "TELEGRAM", "user_id": "customer_123" }, "variables": { "order_no": "SO-20260903-0001", "eta": "Sept 5" } }
                      
                      POST {Webhook URL}
Content-Type: application/json
Authorization: Basic base64(username:password)

{
  "idempotency_key": "order-20260903-0001",
  "target": {
    "channel": "TELEGRAM",
    "user_id": "customer_123"
  },
  "variables": {
    "order_no": "SO-20260903-0001",
    "eta": "Sept 5"
  }
}

                    
This code block in the floating window
Field Required Description
idempotency_key No Idempotency key, up to 128 characters. Duplicate requests with the same key within 24 hours are rejected, preventing duplicate sends caused by business system retries
target.channel Yes Target channel. Values match the channel enum, e.g. WEB, TELEGRAM, WHATSAPP_META, LINE
target.user_id One of the two Business user ID (logged-in user)
target.aid One of the two Anonymous user ID (visitor who is not logged in)
variables No Custom variables that can be referenced in the trigger message via {{event.variables.field_name}}

Note: A successful Webhook request only means "received and queued for sending". Check the execution history for the actual delivery result. Authentication failure, a stopped task, or a target channel outside the task's configured target channels will all return a permission error. Each Webhook URL is rate-limited to 120 requests per minute.

Passive - User Triggered

The platform scans all target users once every minute, and users who match the rules trigger a send. Suitable for scenarios such as re-engaging inactive users and nurturing high-value users.

Rule Configuration

Click Add rule to add rules. Multiple rules can be combined with AND (all must match) or OR (any one matches).

Rule field Type Available operators Example
User's last chat time Time N minutes/hours/days ago, within the last N minutes/hours/days Last chat time was 3 days ago
Total chats Number equals / not equals / greater than / greater than or equal to / less than / less than or equal to / is empty / is not empty Total chats ≥ 10
User attributes String / Number / Boolean / List / Time Depends on the type: equals / not equals / contains / is true / is in… Membership level is in [VIP, Platinum]
Custom attributes String / Number / Boolean / List / Time Same as above Campaign switch is true

Note: User attributes come from "Variable Management → User Attributes" and are evaluated per user (the attribute's default value is used if the user has not set one), which makes them suitable for filtering by user profile. Custom attributes come from "Variable Management → Custom Variables" and are Agent-level values that are the same for all users, which makes them suitable as "master switch" conditions. All rule fields are evaluated based on the user's most recently active conversation on the target channel.

Message Frequency

Passive triggered tasks must have frequency control set: within the configured window (N hours / N days), the same user will be triggered by this task at most once, so that users who continuously match the rules are not repeatedly disturbed.

Tip: User's last chat time is a time in the "past", so use operators of the "N units ago" kind. Operators of the "N units from now" kind only apply to future time fields (such as a subscription expiration time); applied to the last chat time, they will never match.

3. Message

Fill in the message content to be sent to the Agent "on behalf of the user". The Agent generates a reply based on this message together with its own prompt, knowledge base, and so on, and the reply is then pushed to the user.

You can use {{variable}} to reference the following variables:

Variable Description
{{user.userId}} / {{user.aId}} User ID / Anonymous user ID
{{conversation.id}} / {{conversation.subject}} Conversation ID / Conversation subject
{{conversation.recentChatTime}} / {{conversation.messageCount}} Last chat time of the conversation / Message count
{{now}} Current timestamp (milliseconds)
{{event.variables.xxx}} For event triggers, fields from variables in the Webhook request
{{sys_agent_id}}, {{sys_conversation_id}}, {{sys_user_id}}, etc. System variables, the same as those available in conversations

Examples

  • Scheduled broadcast: Please summarize today's top industry news for me in a brief and friendly tone.
  • Re-engaging inactive users: I haven't been here for a few days. Please greet me and tell me what new features have been released recently.
  • Event notification: My order {{event.variables.order_no}} has shipped and is expected to arrive on {{event.variables.eta}}. Please tell me the shipping information and remind me to watch for the delivery.

Tip: The trigger message is a question written for the Agent from the "user's perspective", not copy that is shown directly to the user. If you want the Agent to relay it as-is, state that explicitly in the message, for example "Please tell the user verbatim: …".

After confirming everything is correct, click Create.

Note: Each Agent can have at most 10 tasks in the WAITING / RUNNING state at the same time. Beyond that, you need to stop existing tasks or wait for them to complete first.

Task Status

Status Description
WAITING Waiting. A scheduled task has been created but its first execution time has not yet arrived
RUNNING Running. A scheduled task has started executing on schedule; event / user triggered tasks enter this state immediately after creation, waiting for a Webhook call or a rule match
COMPLETED Completed. Only "Once" scheduled tasks enter this state after they finish executing
TERMINATED Stopped. Entered after manually clicking Stop; cannot be resumed
ERROR Error. The task is automatically halted by a circuit breaker after 10 consecutive failed executions (for example, when a third-party integration becomes invalid). The reason can be viewed in the task details

Viewing Tasks and Execution History

Click View in the list to open the task details, which contain two tabs:

  • Configuration: a read-only view of the task configuration. For event triggered tasks, you can view the Webhook URL and authentication information here.
  • Execution History: a record of each execution, including execution time, number of targets, success / failure counts, and success rate.

Click an execution to view its execution details: success / failure statistics for each channel, along with the individual send records. Failure reasons:

Failure reason Description Suggested action
NO_CONVERSATION The user has no conversation on the target channel, or the conversation creation time is outside the target conversation scope Check the target conversation scope and channel settings
CHANNEL_CONFIG_INVALID The channel integration has been disabled, deleted, or its configuration is invalid Check the corresponding integration under Integrations
CHANNEL_AUTH_FAILED Channel authentication failed (e.g. the Telegram Token is invalid) Update the integration credentials
RATE_LIMITED The send rate limit was reached and no quota was obtained after retrying Narrow the target scope or send in batches
AGENT_FAILED The Agent failed to generate a reply Check the Agent configuration, model, and Credit balance
TIMEOUT Channel delivery timed out (60 seconds per message) Retry later and check the third-party platform status
NOT_IMPLEMENTED This channel does not yet support proactive push Switch to another target channel

Stopping and Deleting

  • Stop: Tasks in the WAITING / RUNNING / ERROR state can be stopped at any time. Once stopped, the task changes to TERMINATED and cannot be resumed.
  • Delete: Only tasks in the COMPLETED / TERMINATED state can be deleted. Deleting a task also removes its execution history and details.

FAQ

Q: Why did the task execute successfully, but the user saw something different from the trigger message I filled in?
The trigger message is "a question sent to the Agent on behalf of the user", and what the user sees is the reply the Agent generated in response to it. If you need precise control over the wording, explicitly instruct the Agent in the trigger message to output it verbatim.

Q: Will new users receive task messages?
No. Tasks are only sent to users who already have conversation history, and the conversation creation time must fall within the "target conversation scope".

Q: Why wasn't my scheduled task sent exactly on the hour?
The scheduler scans once every minute, and large-volume sends are pushed in batches according to the project-level rate limit, so the actual arrival time may be slightly delayed.

Q: The Webhook returns a permission error (Permission deny)?
Check the following in order: whether the Webhook URL is correct, whether the authentication credentials match, whether the task has been stopped, and whether target.channel in the request is one of the target channels configured for the task.