Overview
This article explains how to implement a workaround to update the requester's name when they submit a ticket via the help center.
The Zendesk web widget allows the inclusion of a system name field that requires the end-user to provide their name prior to submitting a ticket, and this updates the requester name in the user profile.
The problem is that the standard ticket form that end-users will use when submitting a request via the help center does not have a system name field included to update the requester name. When a new user submits a ticket the text before the "@" in their email address is used as their name.
To implement this method we will need a:
- Custom "Name" ticket field
- Custom user field (checkbox) to indicate that the name was updated
- Webhook to update the requester name via the API
- Trigger to call the webhook and check the user field
How will this work?
The user will provide their name in the custom ticket field when they submit a ticket using the ticket form. A trigger will call the webhook and will submit the name value in a JSON packet to the Zendesk API to update the requester name, and will then check the custom field in the user profile to prevent the name from being updated every time the user submits a ticket.
Implementing the method.
Step 1: Create a custom Name field that will be used to update the user name and add it to the ticket form. Note the field ID as it will be used later.
Step 2: Create a custom user field checkbox called something like "Name Updated".
Step 3: Generate an API token that will be used to call the API.
- Go to "Admin Center > Apps and Integrations > APIs > Zendesk API" and add a new token. Give it a name like "Update requester name" and make sure you copy the token before you click save.
- Once you save the token you won’t be able to access it again.
- Save the token in a secure location as it provides full access to the Zendesk API.
Step 4: Create a webhook to call the Zendesk API to update the user's name.
- Got to "Admin Center > Apps and integrations > Webhooks > Actions > Create webhook"
- Add the Zendesk API endpoint URL as follows:
https://yoursubdomain.zendesk.com/api/v2/users/{{ticket.requester.id}}.json- Set the request Method to PUT
- Set the Request Format to JSON
- Set the Authentication to Basic
- Add an administrator email address as the username and add ”/token” at the end. Example: adminaccount@avhtech.com/token
- Enter the token generated earlier in the password field.
Step 5: Create a trigger to execute the webhook when new tickets are created via the web form.
- Set conditions:
- Set Actions:
- Note the numbers in italic must be updated to match your custom
name field ID : {{ticket.ticket_field_12345678}})
- Note the numbers in italic must be updated to match your custom
Step 6: Test functionality
- Use the "Submit Request" option in the help center to open the ticket form.
- Create a new ticket and provide your name in the Name field.
- Verify that the user name is updated correctly and the checkbox in the user profile is checked.