Send SMS on status change

147 views
Skip to first unread message

Ashish Chauhan

unread,
Feb 19, 2021, 2:18:41 AM2/19/21
to google-apps-sc...@googlegroups.com
Hi ALL,

I am trying to develop a script that is used to send a message on the status change throughout the production process. 
For example.

Status changes to "In Production" - send a message
status changes to "In Production to In QC" - send a message
Status changes to "Q.C" to "Dispatch" - again send a message

How to capture history data i.e. old value and new value.

Adam Morris

unread,
Feb 19, 2021, 5:59:00 AM2/19/21
to google-apps-sc...@googlegroups.com
Hi there,

You mean you’re using a spreadsheet, with some cells with values whose status can change? Then, when they change, you want an SMS to be arranged to be sent, right?

You can use the onEdit trigger that will be called whenever a cell values changes. You can then look at the event parameter that is sent to the function, and confirm that it’s in the target column with the data that may have changed. The idea is then that you can check if they’ve changed or not.

For that part, you can use PropertiesService, which is a kind of persistence store in the platform. There are some quota limitations, but for a smallish project you’re probably okay, certainly to get started with it.

Adam
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAKGrJp9efcazO0KTMTHxAsAgt8qaWkdNZziS-nhf2f_Yiaqrqg%40mail.gmail.com.
--

Mario Rossi

unread,
Feb 19, 2021, 6:40:27 AM2/19/21
to google-apps-sc...@googlegroups.com
Hi guys.

From a web search I found Martin Hawksey's code:
https://pulse.appsscript.info/p/2020/04/how-to-send-sms-messages-with-google-sheets-and-your-android-phone-digital-inspiration/


https://gist.github.com/mhawksey/1658408

Then I noticed that from my android phone it is possible to send sms directly with google. Here the links:

https://messages.google.com/web/authentication
https://messages.google.com/
https://support.google.com/messages/answer/7611075?hl=en

It would be ideal to be able to send sms using your phone and tariff plan so that a text message is sent when a value appears or does not appear in a gogole scheet cell.

What do you think?

Martin Hawksey

unread,
Feb 20, 2021, 4:40:09 AM2/20/21
to google-apps-sc...@googlegroups.com
Hi Mario,

As Adam points out you can  create a trigger for onEdit events. There is a basic onEdit example in this StackOverflow Q/A https://stackoverflow.com/a/56534975/1027723

In terms of sending an SMS using your tariff this is a lot harder. The MIT App Inventor route from Amit (https://pulse.appsscript.info/p/2020/04/how-to-send-sms-messages-with-google-sheets-and-your-android-phone-digital-inspiration/) is great but App Inventor doesn't have an easy way to run in the background to receive changes and push notifications.

Personally if it was me I would be looking at integrating with services like Twillo. Twillo have examples for interacting with Google Sheets https://www.twilio.com/blog/2016/02/send-sms-from-a-google-spreadsheet.html 


Best
Martin    



--
Martin Hawksey

Latest tweet (see how):

Afternoon working on the 'Getting Schooled on Apps Script - Using Automation in EDU' Totally Unscripted Show page. So many wonderful tips + resources from @alicekeeler and @flubaroo. If you missed the show you can check it out https://t.co/hKhanYV8HK #GoogleEdu #GoogleAppsScript

— Martin Hawksey #altc (@mhawksey) January 30, 2021
Reply all
Reply to author
Forward
0 new messages