Receive remote notifications

This module has everything needed to receive push notifications from a server.

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.

  • 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.


import remote_notifications as rn

actions = {
    "Google": "{}"
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.

remote_notifications.register() → str

Registers the device for push notifications.

Returns a token to use with the api.

Return type:str
remote_notifications.remove_category(category: str)

Removes a category with its given identifier.

Parameters:category – The identifier of the category to remove.

Sending notifications

To send a notification, first you need a token for the device that will receive the notification. Use the register() function.

The API endpoint to send remote notifications is


To send a notification, construct a POST request with the following parameters.

token:The token generated by the device that will receive the notification. (Required)
title:The title of the notification. (Optional)
message:The body of the notification. (Optional)
category:The category of the notification. See add_category(). (Optional)
data:Additional data passed to action URLs. See add_category(). (Optional)