2024-03-11 17:18:44 +01:00
2024-03-11 17:18:44 +01:00
2024-03-02 21:10:28 +01:00
2024-03-02 21:10:28 +01:00

telewarder

Installation

First build the image with docker-compose build.

Set up environment variables in .env file, get them from https://my.telegram.org/apps. Copy .env.example and modify it.

Once built, run once: docker run -it --env-file .env -v $PWD/data:/data telewarder python3 /app/app.py, it will ask for your phone number (use country code, like +34666123456), enter it and follow instructions. When finished, quit with CTRL+c. You should now see telewarder.session and telewarder.session-journal files under data folder.

You're now all set up.

Run

Execute docker-compose up -d

The app will be listening to messages sent to the user only (it won't listen to messages sent to groups where the user is), and make a HTTP POST query to the URL server in the /sendmessage endpoint, it will send the data as follows:

{
    "chat_id": 123456789,
    "message_id": 987654321,
    "message": "Hello, world!"
}

The app will also query the URL in the /readmessages endpoint every few seconds, this should have a response with the following format:

[
    {
        "chat_id": 123456789,
        "message_id": 987654321,
        "message": "Hello, world!"
    },
    {
        "chat_id": 987654321,
        "message_id": 123456789,
        "message": "This is a test message."
    }
]

It will go through every message and send the text as a reply to each one, the data should be the same that the app sent before.

Description
No description provided
Readme 32 KiB
Languages
Python 94.5%
Dockerfile 5.5%