I wrote a Python3 script to Bridge SMS/MMS to matrix/riot.im



  • First, Please know that I'm not a developer so the code you're about to look at is.. well... probably very ugly.

    This script I wrote will bridge SMS and MMS messages with matrix.org synapse server. Everything works in both directions and I've been using it for about a week now. Think of it as texting from the web with Google Messages just without the google 🙂 I still have to catch some more errors and clean up some stuff but overall I think its ready to share.

    Also, its not an "app", its just a Python cli script I keep running in a screen session. My goal here is to have a 'server cell phone' that I leave at home, plugged in, and bridging messages 24/7. I'll never touch it other than to do some updates and fix any problems. I'll use a matrix app such as riot on my desktop and any other device I want. I'll be able to send and receive messages from any where any deivce as long as it has internet.

    How I got it to work is a little hacky. I'm not sure if there's a better way to do it but I'll note it here. Eventually I'll be moving this over to my PinePhone.

    I created a libertine-container,
    Connect to the container as root
    apt install python3/pip3 and then pip install some packages.
    apt install screen
    https://docs.ubports.com/en/latest/userguide/dailyuse/libertine.html#shell-access

    Then I got out of the container and added all of this stuff to my path. Python3 in a container called "learning" is

    /home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/python3

    and screen would be something like
    /home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/screen

    So you just run the app as the normal phablet user but using the containers python3 binary. if you want to leave it running like I do you use the screen binary from the same container.

    If anyone wants to turn this into a real app or really do anything with it, I'm happy to help! I also have some poorly written C code to do the same thing. I got SMS/MMS sending/receiving working and I got SMSes bridged to matrix but when I started to look into dealing with html and json I decided that I'd just use python.


Log in to reply