Search code examples
djangopush-notificationcelerydjango-celerydjango-celery-beat

dynamic, scheduled push notifications using Celery (Django)


I have a model called Schedule which consists of a list of Task. Below is the json representation

{
  id: 1,
  tasks: [
    {
      id: 1,
      date: "2020-09-08",
      message: "xyz",
    },
    {
      id: 2,
      date: "2020-09-10",
      message: "xyz",
    },
    {
      id: 3,
      date: "2020-09-17",
      message: "xyz",
    },
  ],
};

So my question is how do I setup celery to intiate a task which notifies the user(Firebase push notifications) on all the respective dates for the given schedule (The schedules are generated dynamically! throught a GraphQL api)

Any alternative technology is also welcomed (it should work with Django though!)


Solution

  • This can be done easily using periodic tasks in celery

    https://docs.celeryproject.org/en/stable/userguide/periodic-tasks.html