Send and receive Apple iMessages with Slack (and maybe other platforms someday).
This project was inspired by the solution for iMessage on Android offered by PieMessage. The goal is to rely on the fleshed out features of existing, cross-platform messaging clients.
- iCloud account
- OS X 10.11+
- Docker for Mac (not Docker Toolbox!)
- A dedicated Slack team
For this tool to be practical, you will need an always-on installation of Mac OS X 10.11+. Future versions will include support and instructions for use with a Mac OS X virtual machine, but for this guide it will be assumed the installation is on certified Apple hardware.
-
When your operating system is set up, launch
Messages.app
and log into iMessage via your Apple ID -
Ensure iCloud Contacts are synced with the OS
Because iMessage accesses your iCloud Contacts when populating your buddy list, we can't get away with only signing into iMessage via
Messages.app
with your Apple ID. Ensure that your iCloud account is signed in (System Preferences > iCloud
) and thatContacts
is being synced. No other iCloud features need to be enabled, and if this is being run on a dedicated server, it is recommended to disable them. -
Install Docker for Mac
-
Clone this repository onto your machine
-
Open
Terminal.app
and run the installation scriptimessage-liberator$ ./install.sh
-
Set the AppleScript handler for
Messages.app
to the newly installedLiberator.applescript
- Launch
Messages.app
and openPreferences > General
- At the
AppleScript handler
menu, selectLiberator.applescript
- Launch
-
Create a new Slack team
- During the team creation process, ensure you select
Skip for now
at theSend Invitations
step. You will be skipping this step permanently.
Slack will be the replacement client for iMessage on any platform you'd care to use. You need a dedicated Slack team for this, one that NO ONE else has access to. This Slack team should be treated as preciously as your login to iCloud. By the end of this installation, when a buddy iMessages you, you will receive it in a Slack channel dedicated to that buddy. When you respond in the buddy's Slack channel, it will be forwarded along to them via iMessage.
- During the team creation process, ensure you select
-
Generate a Slack authentication token for your newly created team
-
Navigate to https://api.slack.com/docs/oauth-test-tokens
-
Locate the line item for your newly created team on the Test Token Generator table and click the create token button.
Your authentication token will generate. This is what iMessage Liberator uses to make API calls to Slack on your behalf.
This token will enable all admin actions on your team via the Slack API, so it is extremely important it is kept PRIVATE. Should this key ever be compromised, immediately return to the page and click the re-issue token button.
-
-
Copy your Slack authentication token and enter the following command into your terminal:
export SLACK_OAUTH_TOKEN=<YOUR_SLACK_AUTHENTICATION_TOKEN>
Replace
<YOUR_SLACK_AUTHENTICATION_TOKEN>
with your real token.This sets the
SLACK_OAUTH_TOKEN
environment variable in this terminal session. You can make it globally available for all future terminal sessions by adding it to your.bashrc
file or some other method. -
Run the Docker container installation:
imessage-liberator$ docker-compose build imessage-liberator$ docker-compose up
-
Open another terminal window and start the host messaging server:
imessage-liberator$ ./start_servers.sh
You are now up and running.
If something is going wrong with your installation, it can be difficult to debug due to the number of moving parts.
The AppleScript handler set in Messages.app logs messages to ~/Library/logs/iMessageLiberator.log
. Open Console.app
and view that file to see if anything is going wrong. If the log file is missing, it means the Messages.app
iMessage AppleScript handler was not selected properly.
When the Docker container receives a Slack message sent by you, it looks up which buddy it should be forwarded to and then notifies the host server, which sends the iMessage via AppleScript. You can test that the host-side of this chain is working by entering into your browser:
http://10.200.10.1:8999/cgi-bin/liberator.py?body=success&senderHandle=<IMESSAGE_BUDDY_HANDLE>
Replace <IMESSAGE_BUDDY_HANDLE>
with a buddy iMessage handle, probably best to use your own, e.g. you@your.apple.id.com
.
If you changed the IP address or port from the defaults, replace them in the example above as well.
If all is well, this will result in an iMessage being sent to <IMESSAGE_BUDDY_HANDLE>
.