Skip to content

Instantly share code, notes, and snippets.

@cryptomail
Last active May 16, 2023 04:15
Show Gist options
  • Save cryptomail/5ada1cfb6a756a6b152ccc7d5cad805a to your computer and use it in GitHub Desktop.
Save cryptomail/5ada1cfb6a756a6b152ccc7d5cad805a to your computer and use it in GitHub Desktop.
#/bin/sh
# Agent Group Extractor
# 05/15/2023
# Joshua Teitelbaum, Zendesk Inc.
# This could employ undocumented features and is subject to change or break and is not officially supported.
#
# 1. Ensure your API is available through password protection
# 2. in the shell, run the following commands:
# export ZENDESK_USER_EMAIL=youradmin@email.address
# export ZENDESK_USER_PASSWORD=youradminsecretpassword
# export ZENDESK_ADDRESS=companyname.zendesk.com (or vanity subdomain that is mapped)
# 3. Pick a target group, usually found by https://company.zendesk.com/api/v2/groups or through groups UI in Admin Centre
# 4. Run this script:
# ./get_group_with_agents.sh 7237837 <---- The target group id
# 5. Save output via copy / paste or output to a file by:
# ./get_group_with_agents.sh 7237837 > agents_for_7237837.json
group_id=$1
if [ -z "$1" ]
then
echo "\GROUP ID is empty"
exit -1
fi
if [ -z "$ZENDESK_USER_EMAIL" ]
then
echo "\$ZENDESK_USER_EMAIL is empty"
exit -1
fi
if [ -z "$ZENDESK_USER_PASSWORD" ]
then
echo "\$ZENDESK_USER_PASSWORD is empty"
exit -1
fi
if [ -z "$ZENDESK_ADDRESS" ]
then
echo "\$ZENDESK_ADDRESS is empty"
exit -1
fi
curl "https://$ZENDESK_ADDRESS/api/v2/groups/$group_id?include=users" \
-H "Content-Type: application/json" \
-u $ZENDESK_USER_EMAIL:$ZENDESK_USER_PASSWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment