Recent searches
No recent searches

Dan Nolan
Joined Jan 28, 2022
·
Last activity Jan 28, 2022
Following
0
Follower
1
Total activity
14
Votes
3
Subscriptions
5
ACTIVITY OVERVIEW
BADGES
ARTICLES
POSTS
COMMUNITY COMMENTS
ARTICLE COMMENTS
ACTIVITY OVERVIEW
Latest activity by Dan Nolan
Dan Nolan commented,
Morris Coyle no prob, glad to get to show this off lol
View comment · Posted Jan 28, 2022 · Dan Nolan
0
Followers
0
Votes
0
Comments
Dan Nolan commented,
There's side-panel apps that can show the agent the user's other tickets, like Five Most Recent but what you really need to do is require info from the user to start a chat. The best way to stay organized with customer information is to enable the pre-chat form, and you can even customize it.
View comment · Posted Jan 28, 2022 · Dan Nolan
0
Followers
0
Votes
0
Comments
Dan Nolan commented,
This is definitely possible, it's how I do onboarding but it is very complicated and cannot be done with just Zendesk. It really requires knowledge of webhooks, the zendesk API and Python, so for most admins and smaller-sized accounts this is not really going to be worth the effort, but if you're working on an Enterprise instance and need to onboard hundreds or even thousands of agents, this works well for me.
I use Zapier and send it the information I need from Zendesk via a webhook using a "catch webhook" task in Zapier. What I ask for in the Zendesk form is the new agent's name, their email, and because we're such a large company with so many employees I ask for the email of an agent who has the same permissions and group memberships that they would like for the new agent. I have an approved onboard form that is only available to me and when I solve an approved onboard ticket, the webhook fires and sends the info to Zapier. Zapier catches the webhook and runs (something like) this python code:
*this code is just cleaned up to remove my personal info/creds, there's definitely still a lot of redundant definitions and print statements that were just used in testing and never cleaned up because I'm lazy and that's why I automate stuff lol
import requests
import json
# Zapier Data will be packaged like this:
# input_data = {
# 'email': 'new_agent@yourdomain.com',
# 'name': '{{New Agent Name}}',
# 'alias': '{{New Agent Alias}}',
# 'cloned_agent_email': 'cloned_agent@yourdomain.com'
# }
email = input_data['email']
name = input_data['name']
try:
alias = input_data['alias']
except:
alias = name
cloned_agent_email = input_data['cloned_agent_email']
url = 'https://yourdomain.zendesk.com/api/v2/users/search.json?query=' + cloned_agent_email
user = 'your_email@yourdomain.com' + '/token'
pwd = 'YOURAPIKEY'
response = requests.get(url, auth=(user, pwd))
data = response.json()
cloned_agent = data['users'][0]
cloned_agent_id = cloned_agent['id']
custom_role_id = cloned_agent['custom_role_id']
agent_role = cloned_agent['user_fields']['agent_role']
default_group_id = cloned_agent['default_group_id']
#Check if Exists
url = 'https://yourdomain.zendesk.com/api/v2/users/search.json?query=' + email
user = 'your_email@yourdomain.com' + '/token'
response = requests.get(url, auth=(user, pwd))
data = response.json()
print("line 464" + str(data))
if data['count'] == 0:
print("no existen")
exists = 0
elif data['count'] == 1:
new_user = data['users'][0]
new_user_id = new_user['id']
print(new_user_id)
print("new user id: " + str(new_user_id))
print(type(new_user))
exists = 1
else:
print(type(data['users'][0]))
print()
data = json.dumps({
"user": {
"custom_role_id": custom_role_id,
"email": email,
"name": name,
"role": "agent",
"default_group_id": default_group_id
}
})
if exists == 1:
url = 'https://yourdomain.zendesk.com/api/v2/users/' + str(new_user_id)
print(url)
user = 'your_email@yourdomain.com' + '/token'
headers = {'Content-Type': 'application/json'}
response = requests.put(url, data=data, headers=headers, auth=(user, pwd))
new_user = response.json()
print(response.text)
new_user_id = new_user['user']['id']
exists = 1
elif exists == 0:
url = 'https://yourdomain.zendesk.com/api/v2/users/'
user = 'your_email@yourdomain.com' + '/token'
headers = {'Content-Type': 'application/json'}
response = requests.post(url, data=data, headers=headers, auth=(user, pwd))
new_user = response.json()
print("like 495: " + str(new_user))
try:
new_user_id = new_user['user']['id']
except:
exit()
else:
print("boolean messed up")
print("user creation JSON response: " + str(response.json))
print(new_user)
print("new user id: " + str(new_user_id))
# CLONE GROUP MEMBERSHIPS
url = 'https://yourdomain.zendesk.com/api/v2/users/' + str(cloned_agent_id) + '/group_memberships.json'
user = 'your_email@yourdomain.com' + '/token'
headers = {'Content-Type': 'application/json'}
response = requests.get(url, headers=headers, auth=(user, pwd))
data = response.json()
group_memberships = data['group_memberships']
for i in range(0, len(group_memberships)):
url = 'https://yourdomain.zendesk.com/api/v2/group_memberships'
group_id = group_memberships[i]['group_id']
data = json.dumps({
"group_membership": {
'group_id': group_id,
'user_id': new_user_id
}
})
response = requests.post(url, data=data, headers=headers, auth=(user, pwd))
print(response.text)
If you're a smaller company, you can ask for all sorts of custom user attributes on the form rather than cloning an agent, and just have a bunch of if statements like
if input_data[User Department] == 'sales':
department = 'sales'
And then add
"user_fields": {
"agent_department": department
}
to your update ticket payload.
View comment · Edited Jan 28, 2022 · Dan Nolan
0
Followers
2
Votes
0
Comments
Dan Nolan commented,
It could be a bunch of things, usually an issue with permissions from where the pictures are hosted, but there's an article that goes deep on troubleshooting better than I can:
View comment · Posted Jan 28, 2022 · Dan Nolan
0
Followers
0
Votes
0
Comments
Dan Nolan commented,
Yes. It sounds like what you want to do is format the comments better, individually, which you can do by iterating over each one with a for loop. I can't really test it (so very easily could be syntax typos) but it should be something like:
{"ticket": {
{% for comment in ticket.comments %} "Comment": "{{comment.value}}"
{% endfor %}
}
}
I actually just found an article too that goes more into it, and seems like you've got it already but for anyone else looking to do something similar, here's the placeholders reference
View comment · Posted Jan 28, 2022 · Dan Nolan
0
Followers
1
Vote
0
Comments
Dan Nolan commented,
In the admin settings go to channels >> email >> Personalized email replies
click enable.
This only works if you're replying to the ticket via webhook, though. You'd have to create an agent account with the personalized email address you want as the from address and set them as the replier in your webhook. I don't know if you can do it with the regular "email user" trigger action.
View comment · Posted Jan 28, 2022 · Dan Nolan
0
Followers
0
Votes
0
Comments