Tickets Messages And Support Workflows

Awedesk integrations usually revolve around the support ticket lifecycle: ticket creation, replies, assignment, department changes, status changes, email import, satisfaction surveys, and privacy handling.

Core Records

  • Tickets hold the support request subject, requester, assigned staff member, department, status, timestamps, and operational flags.
  • Ticket messages hold customer replies, staff replies, and timeline events.
  • Departments route work to the right team.
  • Labels help staff triage tickets and clients.
  • Staff notes and private notes add internal context when those features are enabled.
  • Attachments, watchers, mobile app records, and integration records are added by Pro modules when available.

Lifecycle Events To Build Around

Use the lifecycle hooks when an integration needs to react to ticket activity:

  • alsp_ticket_new after a ticket is created.
  • alsp_ticket_reply after a reply is added.
  • alsp_create_ticket_message_after after a message is persisted.
  • alsp_ticket_closed when a ticket is closed.
  • alsp_ticket_reopened when a closed ticket is reopened.
  • alsp_ticket_assignee_changed when ownership changes.
  • alsp_ticket_department_changed when routing changes.
  • alsp_ticket_subject_updated when a subject changes.
  • alsp_ticket_marked_spam when a ticket is marked as spam.

Example: Sync New Tickets To A CRM

add_action('alsp_ticket_new', function (int $ticket_id, int $message_id): void {
    $ticket = new ALSP_Model_Ticket($ticket_id);
    $item = $ticket->get_item();

    if (!$item) {
        return;
    }

    my_crm_queue_ticket_sync([
        'ticket_id' => $ticket_id,
        'message_id' => $message_id,
        'subject' => $item['subject'] ?? '',
        'department' => $item['department'] ?? null,
        'agent' => $item['agent'] ?? null,
        'author' => $item['author'] ?? null,
    ]);
}, 10, 2);

Example: Track Reply Activity

add_action('alsp_ticket_reply', function ($ticket, int $message_id): void {
    $ticket_id = is_object($ticket) && isset($ticket->id) ? (int) $ticket->id : (int) $ticket;

    my_support_metrics_increment('awedesk_reply_created', [
        'ticket_id' => $ticket_id,
        'message_id' => $message_id,
        'user_id' => get_current_user_id(),
    ]);
}, 10, 2);

Example: React To Assignment Changes

add_action('alsp_ticket_assignee_changed', function ($ticket, $agent_id): void {
    $ticket_id = is_object($ticket) && isset($ticket->id) ? (int) $ticket->id : (int) $ticket;

    if (!$agent_id) {
        my_external_queue_mark_unassigned($ticket_id);
        return;
    }

    my_external_queue_assign_ticket($ticket_id, (int) $agent_id);
}, 10, 2);

Integration Rules

  • Prefer lifecycle hooks and models over direct table writes.
  • Make external sync jobs idempotent because email import, retries, and cron can repeat work.
  • Treat imported email, guest tickets, chatbot text, and attachments as untrusted input.
  • Check Pro availability before relying on attachment, watcher, staff note, app, or commerce integration features.
  • Keep privacy export and erasure behavior in mind when storing additional support data.

Was this documentation helpful?