Skip to main content

Galactic Messenger is a versatile and efficient Python package designed for sending messages across multiple platforms.

Project description

Galactic Messenger 🚀

Galactic Messenger is a versatile and efficient Python package designed for sending messages across multiple platforms. It provides seamless integration with popular communication channels such as email, Telegram, and WhatsApp, offering a streamlined solution for message delivery. Built with asynchronous capabilities, Galactic Messenger supports batch requests and delivers optimal performance. 💬📨📱

Installation

To install Galactic Messenger, simply use pip:

pip install galactic-messenger

Usage

Here is an example demonstrating how to use Galactic Messenger to send messages: 📝🚀

import asyncio
from galactic_messenger import setup_email
from galactic_messenger import setup_telegram
from galactic_messenger import setup_whatsapp

async def send_messages():
    # Set up email
    email_sender = setup_email("your_email@example.com", "your_password")
    await email_sender({
        "to": "recipient@example.com",
        "subject": "Hello",
        "message": "This is a test email.",
    })

    # Set up Telegram
    telegram_sender = setup_telegram("your_telegram_token")
    await telegram_sender({
        "chatId": "your_chat_id",
        "text": "Hello from Galactic Messenger!",
    })

    # Set up WhatsApp
    whatsapp_sender = setup_whatsapp("http://your-whatsapp-api-endpoint")
    await whatsapp_sender({
        "chatId": "your_group_id",
        "text": "Hello from Galactic Messenger!",
    })

asyncio.run(send_messages())

Features

Email ✉️

  • Send plain text emails
  • Send emails with attachments
  • Supports popular email services like Zoho Mail and Gmail

Telegram 📢

  • Send text messages to Telegram chats
  • Send images with captions to Telegram chats
  • Send videos with captions to Telegram chats

WhatsApp 📲

  • Send text messages to WhatsApp groups
  • Send images with captions to WhatsApp groups
  • Send videos with captions to WhatsApp groups

Batch Requests 🚀

Galactic Messenger seamlessly handles batch requests, allowing you to send multiple messages simultaneously. You can provide an array of messages to the sender functions for efficient batch processing.

async def main():
    # Sending multiple Telegram messages in a batch
    telegram_sender = setup_telegram("your_telegram_token")
    await telegram_sender(
        [
            {
                "chatId": "chat_id_1",
                "text": "Message 1",
            },
            {
                "chatId": "chat_id_2",
                "text": "Message 2",
                "imageBytes": open("./image.png", "rb").read(),
            },
            {
                "chatId": "chat_id_3",
                "text": "Message 3",
                "videoBytes": open("./video.png", "rb").read(),
            },
        ]
    )

    # Sending multiple WhatsApp messages in a batch
    whatsapp_sender = setup_whatsapp("http://your-whatsapp-api-endpoint")
    await whatsapp_sender(
        [
            {
                "chatId": "chat_id_1",
                "text": "Message 1",
            },
            {
                "chatId": "chat_id_2",
                "text": "Message 2",
                "imageBytes": open("./image.png", "rb").read(),
            },
            {
                "chatId": "chat_id_3",
                "text": "Message 3",
                "videoBytes": open("./video.png", "rb").read(),
            },
        ]
    )

Configuration

You can customize the behavior of Galactic Messenger by setting the following environment variables:

  • 📫 EMAIL_SERVICE: The email service provider. Choose "zoho" or "gmail". Default: "zoho".
  • BATCH_TOTAL_TIMEOUT: Total timeout in seconds for batch requests. Default: 30.
  • BATCH_CONNECT_TIMEOUT: Connection timeout in seconds for batch requests. Default: 5.
  • SINGLE_TOTAL_TIMEOUT: Total timeout in seconds for single requests. Default: 10.
  • SINGLE_CONNECT_TIMEOUT: Connection timeout in seconds for single requests. Default: 2.

Contributing

Contributions to Galactic Messenger are welcome! If you find a bug, have a suggestion, or want to contribute code, please open an issue or submit a pull request on the GitHub repository.

Project details


Download files

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

Source Distribution

galactic-messenger-0.1.6.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

galactic_messenger-0.1.6-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file galactic-messenger-0.1.6.tar.gz.

File metadata

  • Download URL: galactic-messenger-0.1.6.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for galactic-messenger-0.1.6.tar.gz
Algorithm Hash digest
SHA256 6e3ca9a30307ca054975f5af6ee9182f4e9f068e6942d0735cc1a3807ee4c1cd
MD5 aa312d9dc8a382c96aa0cef552a4e72e
BLAKE2b-256 4fce6042ad6d5356b72afe27e8a7da94816aaf2586c658d6fbc9b254d7bf9e41

See more details on using hashes here.

File details

Details for the file galactic_messenger-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for galactic_messenger-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 00d7a206be1a43ec6d95a1e0ff4d7a63a83a1fd5916a58a89a3a82b6b1c3d410
MD5 6a0865f798e5cf98b5e18fc7fd689e64
BLAKE2b-256 8de09addc72adaa7f12fcc327ab9a634b9319326b0f664eb59a14ef2e2970a40

See more details on using hashes here.

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