I'm trying to turn a frequently used Automator system service into an Alfred workflow. (It's a simple system service that uses curl to make an HTTP request from the RingCentral API, to place a phone call.)
I understand the basics of bash scripting but I had help in creating this workflow and I'm not sure how to re-do the script for Alfred.
Here's what the service looks like in Automator:
Here are the two scripts it runs. They're both pretty simple. I'll blank out the personal data in the latter one.
# This removes any characters except numbers from your selection
sed 's/[^0-9+]//g'
and
for f in "$@"
do
curl -silent -o ~/.ringout.html "https://service.ringcentral.com/ringout.asp?cmd=call&username=XXXXXXXXXX&ext=X&password=XXXXXXXXXX&from=XXXXXXXXXX&to=${f}&clid=XXXXXXXXXX&prompt=1"
done
exit 0
As you can see the idea is to take the text (in this case highlighted text using OS X Services) and strip out all non-numeric characters, then plug it into that curl one-liner that ties into the RingCentral API to place a phone call.
Ideally I'd like to be able to call this with a keyword in Alfred so that I could either highlight text, call the keyword, and have it make a phone call to a phone number in the highlighted text, or type the number in as an argument if there's no text highlighted.
Could somebody help get me started? I looked over the documentation but I'm kind of running in circles.
Thanks!