Macrodroid, Discord, SMS & Flask/Bottle

Honimoura

Member
Hello,

I'm on a personal project that has me pulling what's left of my hair.

I created a voice assistant like Cortana and others (Opening applications, searching for files, searching the internet, searching for movies, SpeechToText, Navigation by voice, etc...)

Always wanting more, I'm looking for a way so that all SMS, MMS and discord notifications received on the phone when it is connected to the home wifi are sent to my voice assistant so that she can tell me what I receive, from what type, from whom and what (Discord or sms/mms, sender and the message).

So I tried with a Flask and Bottle server to receive the POST request and Macrodroid to send the information to each notification.

However both seem to work (Server and macrodroid) but don't seem to understand each other (certainly an error on my part)

Because at each notification the Flask or Bottle server shows me the same results :

code 400, message Version de requête incorrecte ('\x13\x01\x13\x02\x13\x03À+À,Ì©À/À0̨À\x13À\x14\x00\x9c\x00\x9d\x00/\x005\x01 \x00\x00\x8b\x00\x17\x00\x00ÿ\x01\x00\x01\x00\x00')

I don't know anything about Flask/Bottle server as much as macrodroid which however is not that complicated.
I should point out that so far I have only tackled Discord notifications.

On the server side I did something simple :

from bottle import Bottle, request

app = Bottle()

@app.route('', method='POST')
def handle_post():
data = request.forms # Récupère les données du formulaire POST
print(data) # Affiche les données reçues
return 'OK'

if __name__ == '__main__':
app.run(host='localhost', port=8080)

Du coté macrodroid j'ai fait une interception de notification de tout type de l'application discord en déclencheur et en action une requete HTTP (POST) avec l'url et le port du serveur, en paramètres de requetes key1 = {not_title}, key2 = {notification}. In order to have the name and the message. Content body, type = application/json. En-tête "Name = {not_title}", "Text = {notification}".

I also specify, I know that I can be connected to two places on the same discord account... but this is not the goal because 2 different accounts and the goal is to be able to obtain this information even by doing something else, which avoids switching between windows if it's not important or having to jump on the phone when you're busy.

The goal will also be to be able to respond to these messages by the voice assistant and therefore to do the opposite (tell the voice assistant to answer, give the text, transfer from pc to phone, from macrodroid to discord or sms depending on the message originally received.

I reassure you, I'm not asking for all this to be done to me, I'm just asking if the problem comes from my macrodroid or server configuration or both. And how to solve this problem. For the rest, I would manage.

If anyone knows, I'd love to have some help because I'm stuck here. On the internet, as soon as you write macrodroid and discord, you only have techniques for macrodroid and its competitor to send an automatic message on discord, but no one seems to be trying to do what I'm looking for... or they hide well ;)


Thank you all!

Google Translate French to English... Sorry if it's not perfect
 

Endercraft

Moderator (& bug finder :D)
(Transfered from French thread)

It's certainly possible, but it depends on how you send the text to Cortana.
I know of a very useful (web) app that allows easy text transfer from any connected device.
The app is called ntfy, their website is accessible at ntfy.sh and as it's open-source it's possible to create your own server, either on your local network or worldwide (but you might as well use the official website for that).
With a single HTTP POST request from MacroDroid, you can transfer text.
Try experimenting with it, the documentation is pretty good.

(I just translated to English with DeepL then changed a few words :) )
 
Top