Jared - A Chat Bot for iMessage
What is Jared?
A powerful and easily extensibile iMessage bot. It makes it possible to add fancy chat bot features to any iMessage conversation. It currently includes some basic scheduling commands built in. API integrations, games, custom emotes, and much more can be added by installing plugins.
Any pull requests and new GitHub issues are much appreciated! If you would like to develop a plugin for Jared, see the plugin section below. I'm always available on Twitter if you have any ideas/suggestions.
How it works
Jared implements an apple script scripting interface which is called upon by the Messages.app script handler. This allows all handling of requests to be taken care of in a native app written in Swift (not AppleScript). It's also multithreaded so it can take care of multiple requests at once. There's a few other iMessage bots I've seen but as far as I know this is the first one that is written in Swift and implements its own AppleScript interface. The plugin modularity via .bundles is another great feature. I think the interface for routing is quite nice, take a look at the source and check it out. Any improvements by pull requests would be much appreciated.
I've tried using private APIs such as MessagesKit to send/receive messages to no avail so far. If you have any leads on this front I'd love to hear about it.
Jared must be run a machine running macOS with an active messages account logged in. It has only been tested on 10.13 High Sierra. It may work in older macOS versions but I can't guarentee anything as there may have been changes to the Applescript scripting support. If you don't want Jared posting as you, it is recommended that you create a new Apple ID and user account on your mac, and run it in the background under that user. That way it's not using your main Apple ID.
Once you have Jared setup you can type /help to get a list of commands. /help,[command name] will give you specific information. Use /reload to reload plugins.
Download the Jared app and run it from the applications folder.
See download section at the top.
Download the Jared script handler and set it in Messages.app Select AppleScript handler in Messages.app preferences, select "Open Script Folder", drag the Jared script handler into that folder, then select it as the handler.
Type /help in a group chat with Jared to see a full list of commands. Type /help,"name of command here" to get detail on that specific command.
Built in commands
For reference, here is a list of the commands built in to Jared. Because functionality can be added with plugins, the built in functionality is kept light.
- Thank You: Thanks Jared
- /ping: Check if the chat bot is available
- /version: Get the version of Jared running
- /send: Send a message repeatedly
- /schedule: Schedule messages
- /name: Change what Jared calls you
- /whoami: Get your name
Note: the name related commands require access to your address book to function. You can disable this if you like. The contacts are used to set/retrieve names only. Nothing is sent to any server.
A configuration file is located at ~/Library/Application Support/Jared/config.json which enables disabling of commands if desired. See config-sample.json for an example.
Plugins are loaded dynamically from the ~/Library/Application Support/Jared/Plugins folder. To install a module, drag it in there and then send "/reload" to Jared.
- None yet!
If you developed any plugins, please contact me a link so I can add a link here! I will be working on a few extra modules of my own as well, and will add them here when they are complete.
If you would like to develop your own plugins, you need to build a .bundle to be loaded by Jared. You must include the JaredFramework.framework in your project and define a public subclass of RoutingModule. The bundle must set this class as the principle class in Info.plist. Info.plist must also contain a string for "JaredFrameworkVersion", the current version number is "J1.0.0".
Take a look at the Sample project to see how the project should be configured. Also look at the modules in contained in the main project for examples of more complicated routings.