Overview
The Tasks API allows you to create, assign, and manage tasks associated with mentions. Tasks are useful for tracking follow-ups, assignments, and collaboration workflows.
Methods
Get Tasks
Fetch all tasks for an alert.
client.get_tasks(
account_id: str,
alert_id: str
) -> TasksResponse
Returns: TasksResponse containing list of tasks
Example:
from mention import MentionClient
client = MentionClient(access_token="your-token")
tasks_response = client.get_tasks("acc_123456", "alert_123")
for task in tasks_response.tasks:
print(f"{task.title} - Status: {task.status}")
if task.assigned_to:
print(f" Assigned to: {task.assigned_to}")
Response:
{
"tasks": [
{
"id": "task_456",
"title": "Respond to customer feedback",
"description": "Customer mentioned issues with the new feature",
"status": "pending",
"assigned_to": "user_789",
"due_at": "2024-01-25T17:00:00Z",
"completed_at": null,
"created_at": "2024-01-20T10:00:00Z",
"updated_at": "2024-01-20T10:00:00Z",
"mention_id": "mention_123",
"alert_id": "alert_123",
"account_id": "acc_123456"
}
]
}
Get Mention Tasks
Fetch all tasks for a specific mention.
client.get_mention_tasks(
account_id: str,
alert_id: str,
mention_id: str
) -> TasksResponse
Returns: TasksResponse containing list of tasks
Example:
tasks = client.get_mention_tasks(
"acc_123456",
"alert_123",
"mention_789"
)
print(f"Found {len(tasks.tasks)} tasks for this mention")
Get Task
Fetch a single task by ID.
client.get_task(
account_id: str,
alert_id: str,
mention_id: str,
task_id: str
) -> Task
Returns: Task object
Example:
task = client.get_task(
"acc_123456",
"alert_123",
"mention_789",
"task_456"
)
print(f"Task: {task.title}")
print(f"Status: {task.status}")
if task.due_at:
print(f"Due: {task.due_at}")
Create Task
Create a new task for a mention.
from mention import CreateTaskRequest, TaskStatus
client.create_task(
account_id: str,
alert_id: str,
mention_id: str,
request: CreateTaskRequest
) -> Task
The mention ID to associate the task with
request
CreateTaskRequest
required
Task creation request
Request Fields:
Task description (optional)
request.status
TaskStatus
default:"pending"
Task status (pending, in_progress, completed, cancelled)
User ID to assign task to
Due date/time (ISO 8601 format)
Returns: Created Task object
Example:
from mention import MentionClient, CreateTaskRequest, TaskStatus
from datetime import datetime, timedelta
client = MentionClient(access_token="your-token")
request = CreateTaskRequest(
title="Follow up with customer",
description="Customer reported an issue with the API integration",
status=TaskStatus.PENDING,
assigned_to="user_789",
due_at=datetime.now() + timedelta(days=2)
)
task = client.create_task(
"acc_123456",
"alert_123",
"mention_789",
request
)
print(f"Created task: {task.id}")
print(f"Assigned to: {task.assigned_to}")
Update Task
Update an existing task.
from mention import UpdateTaskRequest
client.update_task(
account_id: str,
alert_id: str,
mention_id: str,
task_id: str,
request: UpdateTaskRequest
) -> Task
request
UpdateTaskRequest
required
Task update request (all fields optional)
Returns: Updated Task object
Example:
from mention import UpdateTaskRequest, TaskStatus
# Mark task as completed
request = UpdateTaskRequest(
status=TaskStatus.COMPLETED,
description="Updated: Issue resolved with customer"
)
task = client.update_task(
"acc_123456",
"alert_123",
"mention_789",
"task_456",
request
)
print(f"Task updated: {task.status}")
if task.completed_at:
print(f"Completed at: {task.completed_at}")
Delete Task
Delete a task permanently.
client.delete_task(
account_id: str,
alert_id: str,
mention_id: str,
task_id: str
) -> bool
Returns: True if deletion was successful
Example:
success = client.delete_task(
"acc_123456",
"alert_123",
"mention_789",
"task_456"
)
if success:
print("Task deleted successfully")
Models
Task
Represents a task associated with a mention.
| Field | Type | Description |
|---|
id | string | Task ID |
title | string | Task title |
description | string | Task description |
status | TaskStatus | Task status |
assigned_to | string | User ID of assignee |
due_at | datetime | Due date/time |
completed_at | datetime | Completion timestamp |
created_at | datetime | Creation timestamp |
updated_at | datetime | Last update timestamp |
mention_id | string | Associated mention ID |
alert_id | string | Associated alert ID |
account_id | string | Associated account ID |
TaskStatus
Task status enumeration:
PENDING: Task is pending
IN_PROGRESS: Task is in progress
COMPLETED: Task is completed
CANCELLED: Task was cancelled
CreateTaskRequest
Request for creating a new task.
| Field | Type | Required | Default | Description |
|---|
title | string | Yes | - | Task title |
description | string | No | - | Task description |
status | TaskStatus | No | pending | Initial status |
assigned_to | string | No | - | User ID to assign to |
due_at | datetime|string | No | - | Due date/time |
UpdateTaskRequest
Request for updating an existing task.
| Field | Type | Description |
|---|
title | string | New task title |
description | string | New description |
status | TaskStatus | New status |
assigned_to | string | New assignee |
due_at | datetime|string | New due date |