Code Monkey home page Code Monkey logo

py-imessage's Introduction

No longer under active development.

py-imessage

License Downloads

py-imessage is a library to send iMessages from your Mac computer (it does not work on Windows/Linux). It was originally used to build an API for iMessages; however, Apple doesn't support third-parties using iMessage over a few hundred marketing messages per day.

Buy Me A Coffee

Installation

Run the following commands on the terminal

pip install py-imessage

# Disable system integrity protection in order to allow access to chat.db
csrutil disable 

If running csrutil disable doesn't work. Try this stackoverflow post

Sample Usage

from py_imessage import imessage
import sleep

phone = "1234567890"

if not imessage.check_compatibility(phone):
    print("Not an iPhone")

guid = imessage.send(phone, "Hello World!")

# Let the recipient read the message
sleep(5)
resp = imessage.status(guid)

print(f'Message was read at {resp.get("date_read")}')

Documentation

Sending a message

Send a message to a new or an existing contact!

.send(phone, message)

Args

Phone | ten-digit phone number of string type format XXXXXXXXXXX i.e. "1234567890"

Response

Message | The message you plan to send. i.e. "Hi!"

Returns a string, the GUID
Type Description
string GUID unique to the message (used for checking on status)

Message status

Check whether a message you sent has been delivered and read (if read receipts turned on).

.status(guid)

Args

Guid | guid returned from sending a message

Response

Returns a dict, with following fields
Field Type Description Sample
guid string guid that was passed in to the function "3A146100-D269-4F35-BDB4-EB2FF7DBDF0F"
date_submitted datetime date message was submitted "Sun, 12 Apr 2020 05:46:48 GMT"
date_delivered datetime date message was delivered to recipient's phone "Sun, 12 Apr 2020 05:46:49 GMT"
date_read datetime date message was read on recipient's phone "Sun, 12 Apr 2020 05:47:38 GMT"

Checking iMessage compatibility

Check whether a phone number is registered to an iPhone or an Android device. NOTE: This method is exceptionally slow, so you should cache the response.

.check_compatibility(phone)

Args

Phone | ten-digit phone number of string type format XXXXXXXXXXX i.e. "1234567890"

Response

Returns a boolean, compatibility
Type Description
boolean Whether number supports receiving iMessages

Contributing

Please create an issue. Or feel free to add a PR!

py-imessage's People

Contributors

rolstenhouse avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.