Skip to content

irfaan/osa-imessage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

osa-imessage

osa-imessage

A node.js module to interact with iMessage.

Developed for the webmessage project that aims to bring an iMessage client to the browser

Installation

Requires OSX 10.10 Yosemite.

npm install osa-imessage

Usage

###Sending messages

Send a message to a phone number:

var messages = require('osa-imessage');

messages.send('Hello World!', '+15555555555', callback);

Send a message to a contact:

var messages = require('osa-imessage');

messages.send('Hello World!', 'Johnny Appleseed', callback);

Send a message to an iCloud account:

var messages = require('osa-imessage');

messages.send('Hello World!', 'john@icloud.com', callback);

###Receiving messages

var messages = require('osa-imessage');

var messageEvents = messages.listen();

// After messages.listen() is called, osa-imessage must be set
// as the AppleScript handler in Messages.app's preferences page

messageEvents.on('received', function(data){
    var message = data.text;           // "Hello, World!"
    var fromName = data.from.name;     // "Johnny Appleseed"
    var fromHandle = data.from.handle; // "john@icloud.com"
    var time = data.time;              //  Timestamp
});

About

Bring the power of Node.JS to Apple iMessage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%