Skip to content

Push Recipes

NearIT allows you to send any content at a specific time using the push technology.
To create a push, you will need to create a recipe using our "push_machine" as a pulse plugin combined it with an action:

Description Plugin Action
Send a recipe immediately push_machine send_push
Schedule a recipe push_machine send_scheduled_push

The pulse_bundle property can be set as a simple object containing owner and app id.

Example: immediate push notification

POST https://api.nearit.com/recipes

{
  "data": {
    "type": "recipes",
    "attributes": {
      "owner_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "app_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "name": "push now",
      "state_event": "finalize",
      "notification_translations": {
        "en": {
          "body": "Hello World"
        },
        "it": {
          "body": "Ciao Mondo"
        }
      },
      "default_language": "en",
      "operation_plugin_id": "congrego",
      "operation_action_id": "every_user",
      "operation_bundle": {
        "owner_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "app_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      },
      "reaction_plugin_id": "simple-notification",
      "reaction_action_id": "simple_notification",
      "reaction_bundle_id": null,
      "pulse_plugin_id": "push-machine",
      "pulse_action_id": "send_push",
      "pulse_bundle": {
        "owner_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "app_id" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      }
    }
  }
}

Example: schedule a push notification

This simple call will send a scheduled notification to every app users. By setting up the "fire_at" attribute you can schedule notification at a specific time.

POST https://api.nearit.com/recipes

{
  "data": {
    "type": "recipes",
    "attributes": {
      "owner_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "app_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "name": "scheduled push",
      "state_event": "finalize",
      "notification_translations": {
        "en": {
          "body": "Hello World"
        },
        "it": {
          "body": "Ciao Mondo"
        }
      },
      "default_language": "en",
      "fire_at": "2017-11-19T17:38:00.000Z",
      "operation_plugin_id": "congrego",
      "operation_action_id": "every_user",
      "operation_bundle": {
        "owner_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "app_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      },
      "reaction_plugin_id": "simple-notification",
      "reaction_action_id": "simple_notification",
      "reaction_bundle_id": null,
      "pulse_plugin_id": "push-machine",
      "pulse_action_id": "send_scheduled_push",
      "pulse_bundle": {
        "owner_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "app_id":"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      }
    }
  }
}

Complete Reference

For more details about our push notification system please look at the NearIT Push Machine APIs reference.