Make SMS limit more "flexible"?

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Locked
User avatar
Scotty
Posts: 78
Joined: 26 Aug 2016 20:29
Location: Southern California

Make SMS limit more "flexible"?

Post by Scotty » 03 Mar 2017 19:00

I have a flow that I activate when I am busy. It auto-replies to incoming MMSes, sending a predetermined SMS reply to the sender(s). One problem was that, when several people were involved in an MMS "thread", every one of them would get my SMS response whenever any one of the participants added to the MMS thread. So, in an active MMS thread, each participant would receive (say) 4 auto-SMSes per minute from me - and they were not too happy! I addressed the problem by telling Automagic to limit the number of SMS replies sent per unit of time. I chose a value of 1h as my default. It works reasonably well.

However, I have a couple of requests:

1. The flow (correctly) responds to the first incoming MMS by sending an SMS to each of the thread participants. If a second MMS comes in (inside the 1h limit), then the flow (again, correctly) will not send another SMS in response. However, the flow issues an error message (which shows up in the status bar). Since the flow is behaving as designed, this failure to send the SMS autoreponse it isn't really an error - so could the error message be suppressed?

2. Could the SMS limit function be modified to allow it to accept variables (and, specifically, global variables)? If so, then there are at least two variables that could be useful: (i) time of day (e.g., limit the response to 1 SMS, until 4:34PM today); and (ii) duration (e.g., limit the response to 1 SMS within the next {global_Duration}m).

Thanks, Scotty

User avatar
Scotty
Posts: 78
Joined: 26 Aug 2016 20:29
Location: Southern California

Re: Make SMS limit more "flexible"?

Post by Scotty » 13 Mar 2017 03:32

Hi Martin:

Are either of these possible, or should I construct the flow without using the "SMS limit" function (perhaps by building in some kind of duration condition which would precede the sending of an auto response)?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Make SMS limit more "flexible"?

Post by Martin » 14 Mar 2017 09:40

Hi,

Sorry, missed your post.

1. You can handle errors in a flow by adding an exception-connection:
-Select the action that produces the error and drag the (+)-icon to a free area to add an action that should be executed in case the first action produces an error/exception.
-Select the connection between the first and the second action, press the edit-icon and change the connection type to Exception.
The second action will only be executed when the first action produces an error.

2. The limit feature of the SMS action is meant to be used as a safeguard to prevent that a huge amount of messages is sent. You could use global variables to build a different behavior, for example to send only one SMS per phonenumber. To do this, you could create a global variable global_autoresponse initialized to an empty list when you are busy: global_autoresponse = newList();.
Check if the global variable contains the recipient before you send the SMS: containsElement(global_autoresponse, phonenumber);
If the list does not yet contain the phonenumber you can send the SMS and add the phonenumber to the list: addElement(global_autoresponse, phonenumber);

Regards,
Martin

User avatar
Scotty
Posts: 78
Joined: 26 Aug 2016 20:29
Location: Southern California

Re: Make SMS limit more "flexible"?

Post by Scotty » 14 Mar 2017 14:23

Thanks Martin.

I'm aware of the "exceptions" connection (I even explained it to another poster a few weeks back ;) ) but I didn't use it here for 2 reasons. First, as you say, exceptions are for handling errors, and as explained in the OP, rightly or wrongly I don't think that this is an error, because it's doing exactly what I want it to do. Hence, I wondered if the exception message (which, I presume, is generated directly by Automagic) could be suppressed (or not generated). Second, the "send SMS" function was the last item in the flow, so there was nowhere for the exception connector to go. I suppose that I could add some kind of dummy action or condition below it, then run the connector to that.

I'll set it up a different way (and won't use the SMS limit function, at least for now). But - as a separate issue - don't you think it could be useful to allow SMS limit to accept a global variable? At the moment, it doesn't; indeed, its input field seems to have some kind of character limit.

All the best

Scotty

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Make SMS limit more "flexible"?

Post by Martin » 16 Mar 2017 18:53

You are right, exception connections should usually only be used for exceptional cases and not in general since it might very well suppress other errors too. Checking the error text is not very future proof since the error text could change depending on Android version.

Accepting global variables for the limit is tricky since it requires that Automagic potentially remembers all sent SMS since you could increase the global variable from 10 seconds to 24 hours and would probably expect that Automagic still knows how many SMS it sent in the last 24 hours to properly obey the limit.
Maybe condition Execution Count could work for you to avoid the exception-connection. It does not support variables for the time for the same reason the SMS action does not support it.

Regards,
Martin

Locked