Nidhin S G
Nidhin S G

Reputation: 1695

Sending automatic push notification for inactivity Ruby on Rails

In my app i'm using RPush Gem to implement push notifications. Right now admin can send a custom message as notification.

What I want is to send an automatic notification if the user hasn't logged in for 2 days. I can check this in my database where I'm keeping a record like last_logged. But i want to know how to check this automatically and run in background.

Upvotes: 2

Views: 456

Answers (1)

Nona
Nona

Reputation: 5462

Hard to give better suggestions without more detail, but if you're on a platform like Heroku, you can do scheduled cron jobs using their scheduler add on. So the idea is:

1) Implement a rake task that checks whether a user hasn't logged in for 2 days, then send an email to yourself (or whomever) 2) Schedule this rake task via Heroku Scheduler add on

If you're not using Heroku, I'm sure there are equally compatible services you can try to run a cron job.

Upvotes: 1

Related Questions