Sending a phone notification when a script finishes running

Has anyone attempted something like this?
I was having a look at this PowerShell script and wondering if something similar could be initiated in grasshopper.
Suggestions welcome

1 Like

I know that something like this can be done with Python, but you need an external, paid service with an appropriate API (e.g. Vonage, Twilio, Plivo, etc.) that handles the SMS sending. Currently, you still need to make sure that the API is IronPython 2.7 compatible, since that’s what Grasshopper currently uses.
Another way would be to have an external device (e.g. raspberry pi + gsm hat, arduino + gsm shield) with a SIM-card from a local service provider that handles the message transmission, however that’s probably way more complicated.

1 Like

Maybe something like that work
A second phone connected to the pc or the laptop to send sms, using udp and android app created with appinventor, or external module to read simcard

There are also:
voice.google.com
And phone link from windows which allow sending sms,
But you need to find a way how to use them with python

1 Like

Alternatively, you could send a message using Telegram, Signal.

1 Like

I thought this could be a really simple solution:

not SMS but maybe better (not regional)
Signed up for a free IFTTT account and figured out some simple code:

import json
import requests

if x:   
    webhook_url = 'https://maker.ifttt.com/trigger/notify/with/key/xxxxxx'
    body = {"value1":"test"}

    response = requests.post(
    webhook_url, data=json.dumps(body),
    headers={'Content-Type': 'application/json'}
    )

and hit the first wall No module named requests :frowning:

Looks like the requests Python module is not available in IronPython, which is the Python implementation used in Rhino and Grasshopper.

Or that the package is not installed in your IronPython site-packages directory, see linked topic on more details to ensure pip is installed.

Check this, you can use hops to send whatsapp message for free

from flask import Flask
import ghhops_server as hs
from heyoo import WhatsApp

# register hops app as middleware
app = Flask(__name__)
hops = hs.Hops(app)

@hops.component(
    "/sendmsg",
    name="SendMsg",
    description="Send Whatsapp message",
    inputs=[
        hs.HopsBoolean("Send", "S", ""),
        hs.HopsString("Phone Number", "No", ""),
        hs.HopsString("Phone id", "id",""),
        hs.HopsString("Message", "Msg", ""),
        hs.HopsString("Api", "api", ""),
    ],
    outputs=[
    ]
)
def sendmsg(s, no, id, msg, api):
    messenger = WhatsApp(api, id)
    if s:
        return messenger.send_message(msg, no)

if __name__ == "__main__":
    app.run()

2 Likes

I run into swiftlet by @sergey which makes it ridiculously easy to send a web request.


this using IFTTT webhooks
Following @seghierkhaled’s hint, I might test it with WhatsApp API too.