Overview
Agents are users with access to the helpdesk system who can respond to and manage tickets. The Agents API provides functionality for inviting and managing helpdesk agents.Agent DocType Fields
TheHD Agent DocType contains the following fields:
Unique identifier for the agent (typically the user email)
Link to the User doctype
Display name of the agent
Profile image for the agent
Whether the agent is currently active
Send Invites
Sends invitations to new agents by creating user accounts and HD Agent records.This endpoint is defined in
helpdesk/api/agent.py:6 and is restricted to agents only via the @agent_only decoratorArray of email addresses to invite as agents
Whether to send welcome emails to newly created users
Behavior
For each email address:- Checks if a User record exists
- If not, creates a new User with:
- Email as the identifier
- First name extracted from email (part before @)
- Sends welcome email if
send_welcome_mail_to_useris true - Creates an HD Agent record with:
- User link
- Agent name (from user’s full name)
- User image (from user profile)
Example Request
Response
ReturnsNone on success. Creates the following records:
- User documents (if they don’t exist)
- HD Agent documents
Permissions
This endpoint requires the caller to be an agent (enforced by@agent_only decorator).
Get Agent Details
Retrieve agent information using standard Frappe APIs.List All Agents
Query all agents with filters:Update Agent Status
Agent Assignment
Agents are assigned to tickets using the Assignment feature. See the Tickets API for assignment operations.Agent Groups (Teams)
Agents can be organized into teams using theHD Team DocType. Teams are referenced in:
- Ticket assignments (
agent_groupfield) - Assignment rules
- Saved reply permissions
Agent Permissions
Agents have specific role permissions:- Agent Role: Can create, read, update tickets and related records
- Agent Manager Role: Has additional permissions for managing teams and settings
- System Manager: Full administrative access
Example: Complete Agent Onboarding
Check if User is Agent
Use the utility function fromhelpdesk.utils:
Standard Frappe API Methods
Since HD Agent is a standard DocType, all Frappe document APIs are available:frappe.get_doc("HD Agent", agent_id)- Get single agentfrappe.get_list("HD Agent", filters={...})- Query agentsfrappe.db.exists("HD Agent", agent_id)- Check if agent existsfrappe.delete_doc("HD Agent", agent_id)- Remove agent