I am using simple template to recieve notification on mobile, upon mail arrives (mail arrives to specific folder) > notification with simple headline and subject of email.
I would like to tune it to recieve the notification only from 8:00 - 16:00 and thats it.
I am playing with start of hour: startOfHour()
But so far struggle to define the condition properly.
Regards,
V.
You could create a scheduled query every hour and then create a condition that will only run if it is a certain time like in the picture example.
#{startOfHour(convertFromUtc(UTCNow(),'Eastern Standard Time', 't'), 't')}
Related
Background
A workflow I have allows users to book meetings. The time/day of the meeting is stored in a table along with other details like the email address.
I send them an email reminder 30 minutes in advance.
Problem
In order to send them an email, a recurring event is set up once a week to go through the table and schedule the email to be sent on time - 30 minutes.
I've added the ability to reschedule the meeting. The problem that creates is that the emails are already scheduled, so users get the reminders at the original time, which is confusing.
What I want to do
I want to be able to send them the email at the rescheduled time, but there are technical limitations to the platform I use, which are:
I cannot set up cron/recurring more frequently than every day. This would probably be better than every week, but if someone rescheduled within the day, they would still get the wrong email.
I cannot remove scheduled events - so any recurring events-based workflow would still send the original email.
I know - this is pretty limiting, but am I even approaching this in the right way?
given your constraints, I'd probably go with 'resign'.
But in all seriousness, if you can't remove scheduled events (and I'm guessing you can't 'move' them because this is too advanced for your CTO to get their head around) then the only way I see it is to break the email send process into two steps - send scheduled event to PROXY in-front of your email sender, check if there is another event (i.e. can you add some 'cancelled/moved to data to the original one) and if so don't send it.
For learning purposes, I'm developing an app in app inventor 2 which should send to myself an SMS message with a list of bills with due date equals the current day -1. In other words, if the bill due date is tomorrow, it should send me an SMS today.
I already got the list of bills from tinyDB and I tried use clock.timer() to trigger the SMS. But the problem is when the clock triggers the SMS it sends a lot of messages and do not stop. I want it be sent only one time.
If you want to receive the SMS when the app is closed, you will need to look into app inventor services.
...which should send to myself an SMS message with a list of bills with due date equals the current day -1.
It would help if you provide a screenshot of your relevant blocks, but shouldn't it be the current day +1? The current day -1 would be yesterday. That would explain why you keep getting the message and it doesn't stop.
I want to send emails to various users based on the schedules they have set.
I read about beanstalkd, queues and Delayed Message Queueing and for now it looks like fitting in:
$when = Carbon::now()->addMinutes($minutes); // i can calculate minutes at this moment
\Mail::to($user)->later($when, new \App\Mail\TestMail);
But i'm not quite sure on few things:
User can cancel a future schedule. In that case how do i cancel an email that's suppose to send in future. Can i set condition somewhere that gets checked before sending the actual email? Tried return false on handle method of \App\Mail\TestMail and it started throwing error
Am i using the right approach. I also read about Scheduler but i don't get how i am going to cancel future emails(if they need to be)
There are many ways to approach this. Personally I would queue the emails on a schedule rather than adding them to the queue for later.
So you run a scheduled task once a day (or hour, or minute) which runs a query to select which users require an email, then using that result set, you add a job to the queue for each result.
This way, if a user unsubscribes, you don't have to worry about removing already queued jobs.
Laravel offers quite a nice interface for creating scheduled jobs (https://laravel.com/docs/5.4/scheduling) which can then be called via a cronjob.
I developed a little Event System. By creating a new event the event startdate can be set on the future.
In this case I´m trying to send out a notification to a user, where is participant of this event, that the event started. How i can solve this?
I tried something like this with scheduling and an own ServiceProvider:
$challenges = Auth::User()->challenges()->where('startdate', '<=', Carbon::now())->get();
foreach($challenges as $challenge) {
Notifynder::category('challenge.started')
->from(1)
->to(1)
->url(url("challenge/$challenge->slug"))
->send();
}
But yes, so the notification will send out everytime..not a good solution. I need them only one time when the event startdate switches from future to now.
Do you have an idea? Many thanks in advance!!
Regards
Personally I would just create a new field in database that would indicate if you sent the notifications. If you did not and the start date is after now you want to send notifications and set the flag to 1/true.
Still, the solution you created is not the best/most performant, since now you'll query database at every single request. The better would be to create some CRON job to perodically check for such thing.
For more information check this out:
https://laravel.com/docs/5.2/scheduling
This will provide you some basic informations about what you need to do to perodically make some actions.You may also want to read about Artisan Commands
so you can run it every x minutes.
What happens, if I send multiple ShellToast notifications from background agent at once, for example in ToDo list app I want to notify that 3 tasks should be finished today?
Is it allowed or recommended? Would the user see all three toasts or only the first one?
The scheduled agent only runs once and it's up to you to manage which toast will be shown. In those scenarios you should be using a counter...possibly.
The way I've worked around this sort of thing in the past is just track a time or which toasts have been shown in sort of a queue and just show one every update so you could just rotate through your queue throughout the day until the tasks in app are no longer valid. Or, based on the phone's time, determine what to show (they fire every 30 min or so).
Ultimately, the optimal way is probably having one toast that says "You have 3 tasks to complete" etc etc.
Hope one of those solutions might help!
// Jed