Freshdesk Integration

Freshdesk Integration

Connect Freshdesk to TR-AI via automation rules and API key.

Note:Freshdesk authentication uses an API key passed as Basic auth (key as username, X as password). No OAuth setup is required.

Credentials required

FieldWhere to find it
DomainYour Freshdesk subdomain — e.g. acme from acme.freshdesk.com. Enter only the subdomain, not the full URL.
API KeyFreshdesk → Profile Settings (top-right avatar) → Your API Key

Step 1 — Enter credentials in TR-AI

In your TR-AI Dashboard, open the Freshdesk card. Enter your subdomain (e.g. acme) and your API key. Click Save. TR-AI will verify by calling GET /api/v2/agents/me.

Step 2 — Create a Freshdesk webhook

  1. 1
    Open Webhooks
    Go to Admin → Settings → Integrations → Webhooks → New Webhook.
  2. 2
    Configure the webhook

    Set the following values:

    Webhook settings
    URL:           https://ticketresolve.ai/api/integrations/freshdesk/webhook/{your-trial-id}
    Method:        POST
    Content-Type:  application/json
  3. 3
    Set the JSON payload
    Paste this body template:
Webhook payload
{
  "ticket_id":      "{{ticket.id}}",
  "subject":        "{{ticket.subject}}",
  "description":    "{{ticket.description}}",
  "latest_reply":   "{{conversation.body}}",
  "requester_name": "{{ticket.requester.name}}",
  "requester_email":"{{ticket.requester.email}}",
  "type":           "{{action.type}}"
}
Tip:The type field tells TR-AI whether this is a new ticket (ticket_created) or a customer reply (reply_created). TR-AI uses this to answer only the new message on follow-ups, not the original description.

Step 3 — Create automation rules

You need two automation rules: one for new tickets and one for customer replies.

Rule 1 — New ticket

  1. 1
    Create the rule
    Go to Admin → Helpdesk Productivity → Automation → Ticket Creation. Click New Rule.
  2. 2
    Set conditions
    Ticket → Source → Is → Email (or leave blank to match all channels).
  3. 3
    Set action
    Add action: Trigger Webhook. Select your TR-AI webhook. Set Request type = POST.

Rule 2 — Customer reply (follow-up)

  1. 1
    Create the rule
    Go to Admin → Helpdesk Productivity → Automation → Ticket Updates. Click New Rule.
  2. 2
    Set conditions
    Action performed by → Requester and Reply sent → Is → True.
  3. 3
    Set action
    Add action: Trigger Webhook. Select your TR-AI webhook.

How TR-AI handles Freshdesk payloads

TR-AI accepts three Freshdesk body formats automatically:

  • JSON — standard application/json body.
  • URL-encoded — application/x-www-form-urlencoded form data.
  • Simple text — Freshdesk "Simple" format with key — value lines.

Follow-up reply handling

Freshdesk's {{conversation.body}} placeholder only populates in Reply automations, not Ticket Creation rules. When a follow-up arrives without a latest_reply field, TR-AI waits 1.5 seconds (for Freshdesk write propagation) then fetches the latest conversation directly via GET /api/v2/tickets/{id}/conversations.

TR-AI uses two strategies to find the customer reply:

  • Strategy 1: conversations with incoming=true and private=false.
  • Strategy 2 (fallback): most recent non-private entry (handles Freshdesk delay in setting incoming=true).

Reply formatting

Freshdesk requires HTML in the reply body field. TR-AI converts plain-text resolutions to HTML automatically:

  • Numbered lines (1. / Step N:) → <ol><li> list.
  • Bullet lines (• / - / *) → <ul><li> list.
  • Paragraphs separated by blank lines → <p> blocks.

Triage behaviour

When TR-AI cannot auto-resolve a ticket, it:

  • Posts a public acknowledgement reply to the customer.
  • Assigns the ticket to a group named Triage if one exists — otherwise leaves it open and unassigned.
  • Sets ticket status to Open (status code 2) so agents see it.
  • Sends a Slack notification if configured.

Ticket status codes

CodeStatusWhen TR-AI sets it
2OpenTriage path — ticket needs human attention
4ResolvedAuto-resolved — reply posted successfully
5ClosedNot used by TR-AI (Resolved is preferred so customers can reopen)