Sending tasks to your agent via API

Sometimes, you want your agent to work on a task based on other activities and events that have happened in your other systems.

While we keep working to simplify agent configuration, configuring API channel might require a technical user.

API channel can be enabled on the agent’s configuration page.

Example Use Case

Call a customer who has abandoned their cart for the past 1 hour to find out if they’re having a specific challenge.

Sending tasks via APIs allow you to integrate the agent orchestration layer into your other systems. You can create a new task by sending an API that looks like the structure below.

curl -X 'POST' \
  'https://api.composeai.io/api/v1/tasks/' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: API-Secret-Key' \
  -H 'Content-Type: multipart/form-data' \
  -F 'priority=medium' \ 
  -F 'task=Do one, two and three for me' \  
  -F 'agent_id=abcd-1234-efgh-0987-djhd' \ 
  -F 'frequency=dnr' \ 

The API-Secret-Key can be gotten from Settings > API Keys. The frequency is an optional parameter. It specifies whether you’d love the agent to repetedly work on the task every day, week or month. By default, it’s set to ‘dnr’ value, which will not repeat the task.

API Keys Page

To listen back to the result of the API call, you must enable Webhook channel on your agent configuration page, and register the endpoint where your service is listening for update on tasks the agent is running.

Webhook Channel Settings