{"id":28394927,"url":"https://github.com/alexiii/messageredir","last_synced_at":"2025-06-27T01:31:32.025Z","repository":{"id":258351418,"uuid":"871527452","full_name":"AlexIII/messageredir","owner":"AlexIII","description":"Redirect SMS and other messages to Telegram via Webhook","archived":false,"fork":false,"pushed_at":"2024-10-16T17:42:51.000Z","size":76,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T06:31:42.476Z","etag":null,"topics":["sms","sms-gateway","telegram","telegram-bot","webhook-receiver"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexIII.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-12T07:57:54.000Z","updated_at":"2024-10-18T19:10:20.000Z","dependencies_parsed_at":"2024-10-19T02:47:07.292Z","dependency_job_id":null,"html_url":"https://github.com/AlexIII/messageredir","commit_stats":null,"previous_names":["alexiii/messageredir"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AlexIII/messageredir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexIII%2Fmessageredir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexIII%2Fmessageredir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexIII%2Fmessageredir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexIII%2Fmessageredir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexIII","download_url":"https://codeload.github.com/AlexIII/messageredir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexIII%2Fmessageredir/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262172446,"owners_count":23270009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sms","sms-gateway","telegram","telegram-bot","webhook-receiver"],"created_at":"2025-05-31T19:09:11.583Z","updated_at":"2025-06-27T01:31:32.012Z","avatar_url":"https://github.com/AlexIII.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Message Redir: Redirect Messages to Telegram via Webhook\n\u003cimg align=\"right\" src=\"./messageredir-logo.png\" width=\"200\" /\u003e\n\nThis app serves a webhook that forwards messages to a Telegram bot.\n\nDesigned to work with [SMS to URL Forwarder](https://f-droid.org/en/packages/tech.bogomolov.incomingsmsgateway/) (Android app).\n\nOther potential use cases include automated notifications from server monitoring systems, Grafana, etc.\n\nThis bot is multi-user, meaning you can connect with different Telegram accounts, and forward messages separately.\n\n## Security Considerations\n\n- Do not use other people's servers or bots. They will have access to your messages.\n- Configure HTTPS! Either with an Nginx reverse-proxy or use the built-in HTTPS support. Even without a valid certificate, it offers partial security.\n\n## Usage\n\n1. Run the server\n\n### Run the server in a single `docker` command\n\nPrebuilt image is available on dockerhub: https://hub.docker.com/r/alex3iii/messageredir\n\n```sh\ndocker run -d --name messageredir-inst -e MREDIR_TG_BOT_TOKEN=\"YOUR_TELEGRAM_BOT_TOKEN\" -v \"$(pwd)/messageredir.db:/root/app/messageredir.db\" -p 8089:8080 alex3iii/messageredir:latest\n```\n\nThis will serve HTTP by default. You can pass `MREDIR_TLS_CERT_FILE` and `MREDIR_TLS_KEY_FILE` environment variables to enable HTTPS.\n\n### Or use `docker compose` (recommended)\n\ni. Copy [docker-compose.yaml](./docker-compose.yaml) to an empty directory on your server.\n  ```sh\n  wget https://github.com/AlexIII/messageredir/raw/refs/heads/main/docker-compose.yaml -O docker-compose.yaml\n  ```\n\nii. Create an `.env` file in the same directory and set your configuration there. Example:\n  ```env\n  MREDIR_TG_BOT_TOKEN=\u003cYOUR_TELEGRAM_BOT_TOKEN\u003e\n  MREDIR_LOG_USER_MESSAGES=true\n  MREDIR_TLS_CERT_FILE=tls/tls.crt # Self-signed certificate is generated by Docker Compose. When MREDIR_TLS_* are specified, the app will serve HTTPS.\n  MREDIR_TLS_KEY_FILE=tls/tls.key\n  ```\n\niii. Run:\n  ```sh\n  docker compose up -d\n  ```\n  Remove `-d` on the first try to see the app log (errors, etc).\n  \n  The default HTTP(S) port is 8089. Create `docker-compose.override.yaml` to override the port and/or other settings.\n  \n  See logs with `docker compose logs`.\n\niv. Later, if you want to update to the latest version:\n  ```sh\n  docker compose down\n  wget https://github.com/AlexIII/messageredir/raw/refs/heads/main/docker-compose.yaml -O docker-compose.yaml\n  docker pull alex3iii/messageredir:latest\n  docker compose up -d\n  ```\n\n2. After the server is running, write to the bot from your Telegram account. The `\\start` command will return an access token.\n\n3. Configure the SMS to URL Forwarder app to use this URL:\n  `http(s)://\u003cSERVER_IP_OR_HOSTNAME\u003e:\u003cSERVER_PORT\u003e/\u003cTOKEN_THE_BOT_ISSUED_FOR_YOU\u003e/smstourlforwarder`\n  When using HTTPS with a self-signed certificate, check the \"ignore certificate\" checkbox in the SMS to URL Forwarder app.\n\n## Configuration\n\nAll properties are optional, except `tgBotToken` / `TG_BOT_TOKEN`.\n\n| YAML Property    | Environment Variable        | Type   | Description          |\n|------------------|-----------------------------|--------|----------------------|\n| `tgBotToken`     | `MREDIR_TG_BOT_TOKEN`       | string | Telegram bot token   |\n| `dbFileName`     | `MREDIR_DB_FILE_NAME`       | string | Database file name   |\n| `userTokenLength`| `MREDIR_USER_TOKEN_LENGTH`  | int    | User token length    |\n| `logUserMessages`| `MREDIR_LOG_USER_MESSAGES`  | bool   | Log user messages    |\n| `restApiPort`    | `MREDIR_REST_API_PORT`      | int    | REST API port        |\n| `tlsCertFile`    | `MREDIR_TLS_CERT_FILE`      | string | TLS certificate file |\n| `tlsKeyFile`     | `MREDIR_TLS_KEY_FILE`       | string | TLS key file         |\n| `logFileName`    | `MREDIR_LOG_FILE_NAME`      | string | Log file name        |\n| `MyHost`         | `MREDIR_MY_HOST`            | string | Hostname:Port        |\n\n## How to Post a Message to the Hook\n\nHTTP `POST http://\u003cSERVER_IP_OR_HOSTNAME\u003e:\u003cSERVER_PORT\u003e/\u003cTOKEN_THE_BOT_ISSUED_FOR_YOU\u003e/smstourlforwarder`\n\nBody format:\n\n```\n{\n    \"from\": \"%from%\",\n    \"text\": \"%text%\",\n    \"sentStamp\": %sentStampMs%,\n    \"receivedStamp\": %receivedStampMs%,\n    \"sim\": \"%sim%\"\n}\n```\n\n## License\n\nMIT License © github.com/AlexIII\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexiii%2Fmessageredir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexiii%2Fmessageredir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexiii%2Fmessageredir/lists"}