{"id":13583780,"url":"https://github.com/wtfaremyinitials/osa-imessage","last_synced_at":"2025-04-05T07:01:48.866Z","repository":{"id":23577222,"uuid":"26945335","full_name":"wtfaremyinitials/osa-imessage","owner":"wtfaremyinitials","description":"Send and receive iMessages with nodejs","archived":false,"fork":false,"pushed_at":"2021-02-21T18:14:28.000Z","size":2168,"stargazers_count":322,"open_issues_count":9,"forks_count":96,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-03-24T17:22:38.790Z","etag":null,"topics":["imessage","node","nodejs","osa","promise"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wtfaremyinitials.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-21T04:21:43.000Z","updated_at":"2024-03-09T00:38:57.000Z","dependencies_parsed_at":"2022-08-05T22:30:18.109Z","dependency_job_id":null,"html_url":"https://github.com/wtfaremyinitials/osa-imessage","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtfaremyinitials%2Fosa-imessage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtfaremyinitials%2Fosa-imessage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtfaremyinitials%2Fosa-imessage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wtfaremyinitials%2Fosa-imessage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wtfaremyinitials","download_url":"https://codeload.github.com/wtfaremyinitials/osa-imessage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247299828,"owners_count":20916190,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["imessage","node","nodejs","osa","promise"],"created_at":"2024-08-01T15:03:47.286Z","updated_at":"2025-04-05T07:01:48.634Z","avatar_url":"https://github.com/wtfaremyinitials.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"osa-imessage\n====\n\n![](https://img.shields.io/npm/dm/osa-imessage.svg?style=flat-square)\n![](https://img.shields.io/npm/v/osa-imessage.svg?style=flat-square)\n![](https://img.shields.io/npm/l/osa-imessage.svg?style=flat-square)\n[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\n\u003e Send and receive iMessages through nodejs\n\nInstallation\n===\n\n**Requires OSX 10.10 Yosemite**\n\n```bash\nnpm install osa-imessage --save\n```\n\nUsage\n====\n\nBe sure to require `osa-imessage`:\n\n```js\nconst imessage = require('osa-imessage')\n```\n\n**Send a message**\n```js\nimessage.send('+15555555555', 'Hello World!')\n```\n\n**Receive messages**\n```js\nimessage.listen().on('message', (msg) =\u003e {\n    if (!msg.fromMe) console.log(`'${msg.text}' from ${msg.handle}`)\n})\n```\n\n**Send message to name**\n```js\nimessage.handleForName('Tim Cook').then(handle =\u003e {\n    imessage.send(handle, 'Hello')\n})\n```\n\n**Send message to group**\n```js\nimessage.send('chat000000000000000000', 'Hello everyone!')\n```\n\n**Get recent chats**\n```js\nimessage.getRecentChats(20) // Defaults to 10\n```\n\nAPI\n===\n\n### Send a message\n\n`send(handle, text) -\u003e Promise`\n\nSends a message to the specified handle.\n\n**handle**\n\nType: `string`\n\nThe user or group to send the message to, in one of the following forms:\n- phone number (`+1555555555`)\n- email address (`user@example.com`)\n- group chat id (`chat000000000000000000`)\n\n**text**\n\nType: `string`\n\nThe content of the message to be sent.\n\n**return**\n\nType: `Promise\u003c\u003e`\n\nA promise that resolves when the message is sent, and rejects if the\nmessage fails to send.\n\n### Receive messages\n\n`listen([interval]) -\u003e EventEmitter`\n\nBegins polling the local iMessage database for new messages.\n\n**interval**\n\nType: `number`\n\nThe rate at which the database is polled for new messages. Defaults to the minimum of `1000 ms`.\n\n**return**\n\nType: [`EventEmitter`](https://nodejs.org/api/events.html#events_class_eventemitter)\n\nAn event emitter with that listeners can be attached to. Currently it only has the `message` event.\n\nExample message event\n```js\n{\n    text: 'Hello, world!',\n    handle: '+15555555555',\n    group: null,\n    date: new Date('2017-04-11T02:02:13.000Z'),\n    fromMe: false,\n    guid: 'F79E08A5-4314-43B2-BB32-563A2BB76177'\n}\n```\n\nExample *group* message event\n```js\n{\n    text: 'Hello, group!',\n    handle: '+15555555555',\n    group: 'chat000000000000000000',\n    date: new Date('2017-04-23T21:18:54.943Z'),\n    fromMe: false,\n    guid: 'DCFE0EEC-F9DD-48FC-831B-06C75B76ACB9'\n}\n```\n\n### Get a handle for a given name\n\n`handleForName(name) -\u003e Promise\u003chandle\u003e`\n\n**name**\n\nType: `string`\n\nThe full name of the desired contact, as displayed in `Messages.app`.\n\n**return**\n\nType: `Promise\u003cstring\u003e`\n\nA promise that resolves with the `handle` of the contact, or rejects if nobody was found.\n\n### Get the name associated with a given handle\n\n`nameForHandle(handle) -\u003e Promise\u003cname\u003e`\n\n**handle**\n\nType: `string`\n\nThe handle of a contact.\n\n**return**\n\nType: `Promise\u003cstring\u003e`\n\nA promise that resolved with the full name of the desired contact, as displayed in `Messages.app`.\n\n### Get recents chats\n\n`getRecentChats(limit) -\u003e Promise`\n\n**limit**\n\nType: `integer`\n\nAmount of recent chats to return.\n\n**return**\n\nType: `Promise`\n\nA promise that resolves with an array of chats.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtfaremyinitials%2Fosa-imessage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwtfaremyinitials%2Fosa-imessage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwtfaremyinitials%2Fosa-imessage/lists"}