Automating support ticket creation over the phone can reduce after-hours backlog and keep requests moving without forcing customers into a web form. This article explains how to build an AI support agent that interacts with Zendesk using SignalWire AI Gateway (SWAIG), including creating, updating, and closing tickets, adding comments, and authenticating callers with a support PIN before allowing any ticket operations.
How to provide 24/7 support without breaking the bank
Global organizations, industries requiring around-the-clock service, or anyone looking to expand their customer support coverage can greatly benefit from this integration of SignalWire AI Agents with Zendesk. This code walkthrough demonstrates how to build an AI agent that is always on duty, answering support calls and handling simple tasks outside regular business hours.
The AI agent will be capable of creating, updating, and closing tickets, adding comments, and authenticating users via phone using a support PIN. For more complex queries, the agent queues the ticket for escalation to human agents during business hours.
About SignalWire AI Gateway (SWAIG)
This guide provides a comprehensive walkthrough for implementing an AI agent that uses the SignalWire AI Gateway (SWAIG) to interact with the Zendesk Support API.
SWAIG functions are serverless, declarative functions defined in SignalWire Markup Language (SWML). In this example, SWAIG functions map to Zendesk API endpoints, performing simple tasks like creating, updating, or closing tickets. They act as connectors between SignalWire's infrastructure and external systems like Zendesk, handling most routine tasks.
Enhancing security with support PINs
In industries like finance, healthcare, or insurance, safeguarding customer data is non-negotiable. This system secures customer interactions using Support PINs, so that only verified users can access or modify sensitive data.
The AI agent prompts callers for their PIN and validates it against Zendesk records before proceeding with any operation. This simple mechanism enhances security and compliance with stringent data protection regulations.
SWAIG functions are defined by the SWAIG method within the SWML script. Each SWAIG function maps to a Zendesk API endpoint. In the below examples, you’ll see the SWAIG definitions. For more complex logic, view the Python functions.
Opens a new support ticket in Zendesk using the POST /api/v2/tickets.json Zendesk API endpoint:
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"create_ticket","description":"Creates a new support ticket in Zendesk.","parameters":{"type":"object","properties":{"subject":{"type":"string","description":"The subject or title of the ticket."},"comment_body":{"type":"string","description":"The initial comment or description of the ticket."},"requester_name":{"type":"string","description":"Name of the requester."},"requester_email":{"type":"string","description":"Email of the requester."},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["subject","comment_body","requester_name","requester_email"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"create_ticket","description":"Creates a new support ticket in Zendesk.","parameters":{"type":"object","properties":{"subject":{"type":"string","description":"The subject or title of the ticket."},"comment_body":{"type":"string","description":"The initial comment or description of the ticket."},"requester_name":{"type":"string","description":"Name of the requester."},"requester_email":{"type":"string","description":"Email of the requester."},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["subject","comment_body","requester_name","requester_email"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"create_ticket","description":"Creates a new support ticket in Zendesk.","parameters":{"type":"object","properties":{"subject":{"type":"string","description":"The subject or title of the ticket."},"comment_body":{"type":"string","description":"The initial comment or description of the ticket."},"requester_name":{"type":"string","description":"Name of the requester."},"requester_email":{"type":"string","description":"Email of the requester."},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["subject","comment_body","requester_name","requester_email"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"create_ticket","description":"Creates a new support ticket in Zendesk.","parameters":{"type":"object","properties":{"subject":{"type":"string","description":"The subject or title of the ticket."},"comment_body":{"type":"string","description":"The initial comment or description of the ticket."},"requester_name":{"type":"string","description":"Name of the requester."},"requester_email":{"type":"string","description":"Email of the requester."},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["subject","comment_body","requester_name","requester_email"]}}
Updates an existing support ticket in Zendesk using the PUT /api/v2/tickets/{ticket_id}.json Zendesk API endpoint:
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"update_ticket","description":"Updates an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to update."},"status":{"type":"string","description":"The status to update the ticket to.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true},"comment_body":{"type":"string","description":"A comment to add to the ticket.","nullable":true},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"update_ticket","description":"Updates an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to update."},"status":{"type":"string","description":"The status to update the ticket to.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true},"comment_body":{"type":"string","description":"A comment to add to the ticket.","nullable":true},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"update_ticket","description":"Updates an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to update."},"status":{"type":"string","description":"The status to update the ticket to.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true},"comment_body":{"type":"string","description":"A comment to add to the ticket.","nullable":true},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"update_ticket","description":"Updates an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to update."},"status":{"type":"string","description":"The status to update the ticket to.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Priority level of the ticket.","enum":["low","normal","high","urgent"],"nullable":true},"comment_body":{"type":"string","description":"A comment to add to the ticket.","nullable":true},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
Closes a support ticket in Zendesk by updating its status to "closed" using the PUT /api/v2/tickets/{ticket_id}.json Zendesk API endpoint:
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"close_ticket","description":"Closes a support ticket in Zendesk by setting its status to 'closed'.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to close."}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"close_ticket","description":"Closes a support ticket in Zendesk by setting its status to 'closed'.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to close."}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"close_ticket","description":"Closes a support ticket in Zendesk by setting its status to 'closed'.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to close."}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"close_ticket","description":"Closes a support ticket in Zendesk by setting its status to 'closed'.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to close."}},"required":["ticket_id"]}}
Adds a comment to an existing support ticket in Zendesk using the PUT /api/v2/tickets/{ticket_id}.json Zendesk API endpoint:
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"add_comment","description":"Adds a comment to an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to add a comment to."},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"add_comment","description":"Adds a comment to an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to add a comment to."},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"add_comment","description":"Adds a comment to an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to add a comment to."},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"add_comment","description":"Adds a comment to an existing support ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to add a comment to."},"public":{"type":"boolean","description":"Whether the comment is public (visible to the requester).","default":true,"nullable":true}},"required":["ticket_id"]}}
Retrieves information about a specific ticket in Zendesk using the GET /api/v2/tickets/{ticket_id}.json Zendesk API endpoint:
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_ticket","description":"Retrieves information about a specific ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to retrieve."}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_ticket","description":"Retrieves information about a specific ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to retrieve."}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_ticket","description":"Retrieves information about a specific ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to retrieve."}},"required":["ticket_id"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_ticket","description":"Retrieves information about a specific ticket in Zendesk.","parameters":{"type":"object","properties":{"ticket_id":{"type":"integer","description":"The ID of the ticket to retrieve."}},"required":["ticket_id"]}}
Verifies the caller's support PIN against the stored PIN in Zendesk using the GET /api/v2/search.json Zendesk API endpoint:
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"verify_support_pin","description":"Verifies the caller's support PIN against the stored PIN in Zendesk.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"entered_pin":{"type":"integer","description":"The support PIN entered by the caller."}},"required":["caller_phone_number","entered_pin"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"verify_support_pin","description":"Verifies the caller's support PIN against the stored PIN in Zendesk.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"entered_pin":{"type":"integer","description":"The support PIN entered by the caller."}},"required":["caller_phone_number","entered_pin"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"verify_support_pin","description":"Verifies the caller's support PIN against the stored PIN in Zendesk.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"entered_pin":{"type":"integer","description":"The support PIN entered by the caller."}},"required":["caller_phone_number","entered_pin"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"verify_support_pin","description":"Verifies the caller's support PIN against the stored PIN in Zendesk.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"entered_pin":{"type":"integer","description":"The support PIN entered by the caller."}},"required":["caller_phone_number","entered_pin"]}}
Retrieves ticket numbers for the authenticated user using the GET /api/v2/users/{user_id}/tickets/requested.json Zendesk API endpoint:
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_current_user_tickets","description":"Retrieves ticket numbers for the authenticated user.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"status":{"type":"string","description":"Filter tickets by status.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Filter tickets by priority.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["caller_phone_number"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_current_user_tickets","description":"Retrieves ticket numbers for the authenticated user.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"status":{"type":"string","description":"Filter tickets by status.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Filter tickets by priority.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["caller_phone_number"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_current_user_tickets","description":"Retrieves ticket numbers for the authenticated user.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"status":{"type":"string","description":"Filter tickets by status.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Filter tickets by priority.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["caller_phone_number"]}}
copy
01
02
03
04
05
06
07
08
09
10
11
12
{"name":"get_current_user_tickets","description":"Retrieves ticket numbers for the authenticated user.","parameters":{"type":"object","properties":{"caller_phone_number":{"type":"string","description":"The caller's phone number."},"status":{"type":"string","description":"Filter tickets by status.","enum":["new","open","pending","hold","solved","closed"],"nullable":true},"priority":{"type":"string","description":"Filter tickets by priority.","enum":["low","normal","high","urgent"],"nullable":true}},"required":["caller_phone_number"]}}
Begin with a pilot project to test your AI agent’s capabilities in a controlled environment before implementing in a production environment. We recommend that you:
Test individual functions with mock data
Have actual users test the system
Implement error handling to manage and log errors appropriately
Use environment variables or a secrets manager
Consider encrypting support PINs
Adhere to GDPR and other data protection regulations
Avoid logging sensitive information
By following this guide, you can implement an AI agent that interacts with Zendesk through SWAIG, providing users with the ability to manage support tickets over the phone securely. The integration of support PIN authentication adds an extra layer of security, so that only authorized users can access and modify their tickets.
SignalWire’s infrastructure is designed to support ultra-low latency, meaning your callers will have a smooth conversational experience even under heavy traffic—whether they’re speaking to a human or an AI agent.
If you’re ready to build the future of communications, join our community of developers on Discord!
Frequently asked questions
What is SWAIG and why use it with Zendesk?
SignalWire AI Gateway (SWAIG) lets an AI agent call serverless functions defined in SignalWire Markup Language (SWML). In this integration, those functions map to Zendesk Support API endpoints so the agent can perform ticket operations reliably instead of trying to “type” tickets from freeform conversation.
What can the AI agent do in Zendesk?
The agent can create, update, and close tickets, add comments, and run ticket-related operations after verifying the caller. For complex requests, it can queue the ticket for escalation to a human support team during business hours.
How does support PIN authentication work?
The agent prompts the caller for a support PIN, then a SWAIG function verifies that PIN against Zendesk user records before allowing any ticket creation or updates. This helps prevent unauthorized callers from accessing or changing customer data.
What do I need before I start this tutorial?
You need a Zendesk account with admin access, a SignalWire account, and Python basics. The walkthrough uses a GitHub repo and an .env file with Zendesk credentials such as subdomain, email, and API token.
How do I map SWAIG function arguments to Zendesk fields?
You define SWAIG function arguments in SWML, then map those arguments to the Zendesk payload fields for each endpoint. The guide includes examples for ticket creation and update argument mapping so parameters line up with Zendesk’s expected request format.