add_category

remote_notifications.add_category(id: str, actions: dict[str, str])

Adds a category of notification.

A category contains set of actions for a certain type of notifications.

Parameters:
  • id – The unique identifier of the category.

  • actions – A dictionary with actions displayed by the notification.

The actions are in a dictionary. Each key is the name of an action and its value is a URL that will be opened when the action is pressed. The "{}" characters on URLs will be replaced by a percent encoded data sent by the server.

Example:

import remote_notifications as rn

actions = {
    "Google": "https://www.google.com/search?q={}"
}
rn.add_category("google", actions)

In the example above, if a notification with the category id “google” is received, an action will be added to the notification. When it’s pressed, Pyto will search on Google for the data passed by the server.