Skip to main content

A Python Interface for iMessage on MacOS

Project description

๐Ÿš€๐Ÿ’ฌ macpymessenger

macpymessenger is a Python library that provides a simple interface for sending iMessages on macOS. It allows you to send text messages programmatically using the Messages app on your Mac.

Features

Feature Status
Send text messages โœ…
Check compatibility โŒ
Send images โŒ
Send attachments โŒ
Receive messages โŒ
Group messaging โŒ
Bulk messaging โŒ
Message history retrieval โŒ
Message status retrieval โŒ

๐Ÿ”‘ Installation

You can install macpymessenger using pip:

pip install macpymessenger

๐Ÿง‘๐Ÿฝโ€๐Ÿ’ป Usage

Here's a simple example of how to use macpymessenger to send a text message:

from i_py_messenger import IMessageClient, Configuration

config = Configuration()
client = IMessageClient(config)

phone_number = "1234567890"
message = "Hello, this is a test message sent using macpymessenger!"

success = client.send(phone_number, message)

if success:
    print("Message sent successfully!")
else:
    print("Failed to send the message.")

โš™๏ธ Configuration

The Configuration class allows you to customize the paths to the AppleScript files used by macpymessenger. By default, it uses the following paths:

  • send_script_path: osascript/sendMessage.scpt
  • check_compatibility_script_path: osascript/checkCompatibility.scpt

You can modify these paths if needed by creating an instance of the Configuration class and setting the desired paths.

๐Ÿงช Testing

macpymessenger includes a test suite to ensure the functionality of the library. To run the tests, make sure you have the required dependencies installed and execute the following command:

python -m pytest test.py

The tests cover the following scenarios:

  • Sending a message successfully
  • Initializing the Configuration class
  • Verifying the paths of the AppleScript files

๐Ÿ“ฆ Project Structure

macpymessenger/
โ”œโ”€โ”€ i_py_messenger/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ configuration.py
โ”‚   โ”œโ”€โ”€ imessage_client.py
โ”‚   โ””โ”€โ”€ osascript/
โ”‚       โ””โ”€โ”€ sendMessage.scpt
โ”œโ”€โ”€ .env.template
โ”œโ”€โ”€ .github/
โ”‚   โ””โ”€โ”€ workflows/
โ”‚       โ””โ”€โ”€ python-publish.yml
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ setup.py
โ””โ”€โ”€ test.py

๐Ÿ“œ License

macpymessenger is licensed under the Apache License 2.0. See the LICENSE file for more information.

๐Ÿค Contributing

Contributions to macpymessenger are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

๐Ÿ™ Acknowledgements

Originally forked from Rolstenhouse/py-iMessage, macpymessenger was inspired by the need for a simple and intuitive way to send iMessages using Python on macOS. Special thanks to the developers of the libraries and tools used in this project.

๐Ÿ“ง Contact

If you have any questions or inquiries, feel free to reach out to me:

Thank you for using macpymessenger!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macpymessenger-0.1.0.tar.gz (7.5 kB view hashes)

Uploaded Source

Built Distribution

macpymessenger-0.1.0-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page