trigger post to Slack with Hazel?

Talk, speculate, discuss, pontificate. As long as it pertains to Hazel.

Moderators: Mr_Noodle, Moderators

trigger post to Slack with Hazel? Thu Jul 30, 2015 11:10 am • by ecormany
I've just started using Slack, and one of the things I was excited about was various integrations. I want to post to Slack when items in a certain Dropbox folder are added/modified. I can set up an IFTTT rule that talks directly between the two services, but it's limited because it's a) slow and b) doesn't look inside subfolders.

I know the basic Hazel rule setup I need for this:
1 if kind is folder --> run rules on folder contents
2 if date last matched is blank --> post new file message
3 if date last modified is after date last matched --> post updated file message

I just don't know how to get Hazel to do the message posting on my behalf. The Slack desktop app appears to have no AppleScript support. Perhaps I can use a command line tool that can access Slack and run a shell script? Does anyone have experience with any of the CLI tools here? https://api.slack.com/community
ecormany
 
Posts: 28
Joined: Wed Apr 25, 2012 6:15 pm

Re: trigger post to Slack with Hazel? Thu Jul 30, 2015 2:40 pm • by Mr_Noodle
Another thing to try is to do it via a web API (I assume they have one). You can use curl to post an http request from a shell script.
Mr_Noodle
Site Admin
 
Posts: 11236
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: trigger post to Slack with Hazel? Thu Jul 30, 2015 3:09 pm • by ecormany
It looks like slackcat has the friendliest syntax (perhaps possible to even use a Hazel token to determine which channel it will post in). I'll have to do some experimentation.
ecormany
 
Posts: 28
Joined: Wed Apr 25, 2012 6:15 pm


Return to Open Discussion