Forked from dartov/Set custom status on Slack.applescript
Created
August 14, 2017 11:34
-
-
Save Nklya/75c03834af51aae8d89711d6a95d1acd to your computer and use it in GitHub Desktop.
Sets custom status on Slack
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
use framework "Foundation" | |
use scripting additions | |
set statusText to "working remotely" | |
set statusEmoji to ":house_with_garden:" | |
-- legacy token is available at https://api.slack.com/custom-integrations/legacy-tokens | |
set token to "super-secret-token" | |
-- | |
set status to "{ \"status_text\": \"" & statusText & "\", \"status_emoji\": \"" & statusEmoji & "\" }" | |
set curlString to "curl 'https://slack.com/api/users.profile.set?token=" & token & "&profile=" & urlEncode(status) & "'" | |
do shell script curlString | |
on urlEncode(input) | |
tell current application's NSString to set rawUrl to stringWithString_(input) | |
set theEncodedURL to rawUrl's stringByAddingPercentEscapesUsingEncoding:4 | |
return theEncodedURL as Unicode text | |
end urlEncode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment