Last active
March 5, 2018 06:47
-
-
Save itsolver/16206d141a93bb095a433aab1f4b810d to your computer and use it in GitHub Desktop.
Applescript to automate switching Zendesk Talk to web client. My solo tech support job involves switching between help desk and desktop support. Often I forget to switch Zendesk Talk to web client after unlocking my laptop, causing calls to route via the (more expensive) phone.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
display notification with title "Zendesk Talk availability" subtitle "Set to web client" | |
do shell script "#!/bin/sh | |
#Your Zendesk URL has two parts: a subdomain name you chose when you set up your account, followed by zendesk.com (for example: mycompany.zendesk.com). | |
#Your Zendesk User ID is found in Agent Profile URL. | |
#Requires Zendesk API Token Access | |
#Add Activate API Token to Keychain as a new Password item, set account name to your $zendeskUsername + '/token', e.g. 'sue@example.com/token'. | |
##### | |
#Enter your credentials here: | |
zendeskSubdomain= | |
zendeskUserID= | |
zendeskUsername= | |
get_pw () { | |
security 2>&1 >/dev/null find-generic-password -ga $zendeskUsername/token|ruby -e 'print $1 if STDIN.gets =~ /^password: \"(.*)\"$/' | |
} | |
curl https://$zendeskSubdomain.zendesk.com/api/v2/channels/voice/availabilities/$zendeskUserID.json -H \"Content-Type: application/json\" -d '{\"availability\": {\"via\": \"client\", \"available\": true}}' -v -u $zendeskUsername/token:$(get_pw) -X PUT" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mix this script in with ControlPlane to run the script/app upon screen unlock.
Script for switching to phone: https://gist.github.com/itsolver/795ea4bd29805721ab65433119ecaaee
I like to see a notification when scripts are running. To stop these notifications from building up in your Notification Center, go to System Preferences > Notifications > Script Editor and untick 'Show in Notification Center'.