The Sunshine Conversations action Update User can be used to update custom fields in Zendesk, both free text and drop-down fields.
For free text, it's straightforward (just use the Zendesk field ID) and described in the Actions Overview - Sunshine Conversations article, but for drop-down fields, you can either:
If you need to update different fields at different times in the conversation, it’s better to use Option 2 with the field value IDs.
Option 1: Tags
Each Zendesk drop-down field value has an associated tag. This is what you would typically use in Zendesk Chat integrations to select drop-down items.
The difference with Sunshine Conversations is that instead of updating the field, we can just set the tag directly. As long as it matches the tag associated with the field value, it also selects that option in the drop-down automatically.
Get Tag Value
In Zendesk, go to Setting > Ticket Fields and open the field you’re looking to update.
In the Field Values section, click the Show Tags option at the top right to see the corresponding tags for each drop-down value.
Add Sunshine Conversation Action
For this, we’ll use the Add Tag action.
Option 2: Field Value IDs
These field value IDs are available via the Zendesk API via an API call or in the browser. Here’s how you can get them and use them:
1) Via the API
Make sure Zendesk is set up to allow API calls
Activate the Zendesk API in Zendesk Support > Channels > API
For the easiest authentication, enable “Password access” (you can disable it right after you get the field information)
Use the List Ticket Fields request
Zendesk documentation here.
- Open Terminal (if you’re using Windows, you might need to install cURL first before you can do this in the command line)
- Copy this command, replacing the {placeholders} with the correct values from the Zendesk instance:
curl https://{subdomain}.zendesk.com/api/v2/ticket_fields.json -v -u {email_address}:{password}
- Hit Enter
Copy the resulting JSON from the end of the message in Terminal starting at “ticket_fields”
2) Via the browser
- Sign in to Zendesk as an admin.
- Go to this URL in your browser:
https://{subdomain}.zendesk.com/api/v2/ticket_fields.json
- Right-click to save the file if it doesn’t download automatically.
Once you have the ticket_fields.json file, you can…
Find the field value ID
Paste the JSON in a text editor, ideally one with JSON formatting like VSCode or Sublime
Locate the name of the field, e.g. “Ticket Reason”
Find the property “custom_field_option” where you’ll see a list of the drop-down values and their IDs. It should look like this:
Add Sunshine Conversation Actions
In the Ultimate dashboard, add an Update User Metadata action at the bot or dialogue level.
For the Key, add the ID of the field to be updated
For the Value, add the ID of the drop-down value to select
Here’s what it should look like: