All Projects → wtfaremyinitials → Osa Imessage

wtfaremyinitials / Osa Imessage

Licence: mit
Send and receive iMessages with nodejs

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Osa Imessage

node-steamapi
A nice Steam API wrapper for nodejs
Stars: ✭ 112 (-57.58%)
Mutual labels:  promise
resloader
🎉A image preloaded plugin and can display the loaded image progress bar
Stars: ✭ 20 (-92.42%)
Mutual labels:  promise
tall
Promise-based, No-dependency URL unshortner (expander) module for Node.js
Stars: ✭ 56 (-78.79%)
Mutual labels:  promise
android-promise
A Javascript style Promise library for Android JVM
Stars: ✭ 23 (-91.29%)
Mutual labels:  promise
bs-promise-monad
Monadic syntax to work with promise in ReasonML
Stars: ✭ 38 (-85.61%)
Mutual labels:  promise
tish
A replacement of shell script with TypeScript, for those who love TypeScript and tired of writing shell script, aiming to emulate shell script in TypeScript.
Stars: ✭ 119 (-54.92%)
Mutual labels:  promise
replace-in-files
Replace text in one or more files or globs.
Stars: ✭ 21 (-92.05%)
Mutual labels:  promise
Vue Modal Dialogs
Promisify dialogs in Vue!
Stars: ✭ 259 (-1.89%)
Mutual labels:  promise
Promises
It's just another Promise library...
Stars: ✭ 43 (-83.71%)
Mutual labels:  promise
asynqro
Futures and thread pool for C++ (with optional Qt support)
Stars: ✭ 103 (-60.98%)
Mutual labels:  promise
doasync
Promisify functions and objects immutably
Stars: ✭ 27 (-89.77%)
Mutual labels:  promise
executive
🕴Elegant command execution for Node.
Stars: ✭ 37 (-85.98%)
Mutual labels:  promise
run exclusive
⚡🔒 Wait queue for function execution 🔒 ⚡
Stars: ✭ 22 (-91.67%)
Mutual labels:  promise
bitmex-orderbook
The fastest order book implementation for the BitMEX WebSocket API.
Stars: ✭ 73 (-72.35%)
Mutual labels:  promise
wxapp-api-interceptors
微信小程序api拦截器
Stars: ✭ 99 (-62.5%)
Mutual labels:  promise
chomex
Chrome Extension Messaging Routing Kit / Promisify Chrome Messaging / LocalStorage Object Mapper
Stars: ✭ 41 (-84.47%)
Mutual labels:  promise
advisory-lock
Distributed locking using PostgreSQL advisory locks (Node.js)
Stars: ✭ 45 (-82.95%)
Mutual labels:  promise
Creed
Sophisticated and functionally-minded async with advanced features: coroutines, promises, ES2015 iterables, fantasy-land
Stars: ✭ 265 (+0.38%)
Mutual labels:  promise
rhea-promise
A promisified layer over rhea AMQP client
Stars: ✭ 23 (-91.29%)
Mutual labels:  promise
node-split-file
🌱 NodeJS Module to split and merge files for several purposes like transporting over unstable networks.
Stars: ✭ 33 (-87.5%)
Mutual labels:  promise

osa-imessage

styled with prettier

Send and receive iMessages through nodejs

Installation

Requires OSX 10.10 Yosemite

npm install osa-imessage --save

Usage

Be sure to require osa-imessage:

const imessage = require('osa-imessage')

Send a message

imessage.send('+15555555555', 'Hello World!')

Receive messages

imessage.listen().on('message', (msg) => {
    if (!msg.fromMe) console.log(`'${msg.text}' from ${msg.handle}`)
})

Send message to name

imessage.handleForName('Tim Cook').then(handle => {
    imessage.send(handle, 'Hello')
})

Send message to group

imessage.send('chat000000000000000000', 'Hello everyone!')

Get recent chats

imessage.getRecentChats(20) // Defaults to 10

API

Send a message

send(handle, text) -> Promise

Sends a message to the specified handle.

handle

Type: string

The user or group to send the message to, in one of the following forms:

  • phone number (+1555555555)
  • email address ([email protected])
  • group chat id (chat000000000000000000)

text

Type: string

The content of the message to be sent.

return

Type: Promise<>

A promise that resolves when the message is sent, and rejects if the message fails to send.

Receive messages

listen([interval]) -> EventEmitter

Begins polling the local iMessage database for new messages.

interval

Type: number

The rate at which the database is polled for new messages. Defaults to the minimum of 1000 ms.

return

Type: EventEmitter

An event emitter with that listeners can be attached to. Currently it only has the message event.

Example message event

{
    text: 'Hello, world!',
    handle: '+15555555555',
    group: null,
    date: new Date('2017-04-11T02:02:13.000Z'),
    fromMe: false,
    guid: 'F79E08A5-4314-43B2-BB32-563A2BB76177'
}

Example group message event

{
    text: 'Hello, group!',
    handle: '+15555555555',
    group: 'chat000000000000000000',
    date: new Date('2017-04-23T21:18:54.943Z'),
    fromMe: false,
    guid: 'DCFE0EEC-F9DD-48FC-831B-06C75B76ACB9'
}

Get a handle for a given name

handleForName(name) -> Promise<handle>

name

Type: string

The full name of the desired contact, as displayed in Messages.app.

return

Type: Promise<string>

A promise that resolves with the handle of the contact, or rejects if nobody was found.

Get the name associated with a given handle

nameForHandle(handle) -> Promise<name>

handle

Type: string

The handle of a contact.

return

Type: Promise<string>

A promise that resolved with the full name of the desired contact, as displayed in Messages.app.

Get recents chats

getRecentChats(limit) -> Promise

limit

Type: integer

Amount of recent chats to return.

return

Type: Promise

A promise that resolves with an array of chats.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].