Skip to main content

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.

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!

Metadata

Release files for py-iMessage 1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-iMessage 1.7
File Size Uploaded Provenance Actions
py-iMessage-1.7.tar.gz 6.3 kB Without provenance Details for py-iMessage-1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-iMessage 1.7
File Interpreter ABI Platform Actions
py_iMessage-1.7-py3-none-any.whl Python 3 none any Details for py_iMessage-1.7-py3-none-any.whl

Total release size: 13.5 kB

Release files / py-iMessage-1.7.tar.gz

Download URL py-iMessage-1.7.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2f11295493be29b9386814f21fab2e80db79cc97551eb56947560c5fb30af48e
BLAKE2b-256 checksum
How to use checksums
c8f68963f8a3b0f9dcb10e27ff4ddd31c0e78cc4cd38825f16d88e1469116be0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1

Release files / py_iMessage-1.7-py3-none-any.whl

Download URL py_iMessage-1.7-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa3e86baa8935cac0dfeeea111a86f9ba0be8d96c19f72eca2e84fbad1dc3a82
BLAKE2b-256 checksum
How to use checksums
4719afff32be8d68b9623c8c168d2d1550897ee5ea6366529747b28b7882ce3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1

Security for py-iMessage 1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page