Skip to content

Commit

Permalink
getRecentChats
Browse files Browse the repository at this point in the history
  • Loading branch information
briangonzalez committed Sep 8, 2017
1 parent e73ce41 commit 19285f4
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,38 +20,41 @@ npm install osa-imessage --save
Usage
====

**Send a message**
Be sure to require `osa-imessage`:

```js
const imessage = require('osa-imessage')
```

**Send a message**
```js
imessage.send('+15555555555', 'Hello World!')
```

**Receive messages**
```js
const imessage = require('osa-imessage')

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

**Send message to name**
```js
const imessage = require('osa-imessage')

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

**Send message to group**
```js
const imessage = require('osa-imessage')

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

**Get recent chats**
```js
imessage.getRecentChats(20) // Defaults to 10
```

API
===

Expand Down Expand Up @@ -140,3 +143,19 @@ The full name of the desired contact, as displayed in `Messages.app`.
Type: `Promise<string>`

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

### 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.

0 comments on commit 19285f4

Please sign in to comment.