Thursday, December 14, 2017

View App Store reviews on Slack


AppStoreReviews is a command line tool which can send latest reviews for an app to Slack using Incoming Webhooks.

The tool can be called with following arguments:
-a AppId -c CountryCode -s WebHookId
For example: AppStoreReviews -a 584557117 -c us -s 234234/sdfsf/234324

Only AppId is mandatory. If WebHookId is omitted, reviews will be printed to standard output.

To obtain Slack Webhook URL, Slack app needs to be created with Incoming Webhooks feature.  Last 3 parts of URL are used as WebHookId.

To automate messaging process, we can tell OS to call the tool at designated times. To do that create a file containing job description and place it in ~/Library/LaunchAgents.

For example, this is job description that calls tool every day at 8:45:

 <?xml version="1.0" encoding="UTF-8"?>  
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
 <plist version="1.0">  
 <dict>  
  <key>KeepAlive</key>  
  <false/>  
  <key>Label</key>  
  <string>com.mijocoder.AppStoreReviews</string>  
  <key>ProgramArguments</key>  
      <array>  
         <string>/Users/mijo/Dev/appstore-cli/AppStoreReviews</string>  
         <string>-a</string>
         <string>584557117</string>   
         <string>-s</string>
         <string>234234/sdfsf/234324</string>  
      </array>  
  <key>StandardOutPath</key>  
  <string>/Users/mijo/Dev/appstore-cli/log.stdout</string>  
  <key>StartCalendarInterval</key>  
   <array>  
    <dict>  
     <key>Hour</key>  
     <integer>8</integer>  
     <key>Minute</key>  
     <integer>45</integer>  
    </dict>  
   </array>  
 </dict>  
 </plist>  

To find out more about Launch Agents check launchd.info.