Inherits from NSObject
Declared in APSPushNotifications.h

Overview

The Push Notifications API lets you send push notifications to your users who are on iOS and Android Devices. For more details about the underlying REST object, see the ACS API Docs.

Tasks

Class Methods

notify:withBlock:

Sends push notifications to one or more users who are subscribed to a channel.

+ (void)notify:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • channel (NSString): Name of the channel. (required)
  • friends (Any): If this parameter is specified (regardless of the parameter’s value), push notifications are sent to any of the user’s Friends who are subscribed to the identified channel.
  • to_ids (NSString): Comma-separated list of user IDs to send the notification to users who are subscribed to the specified channel.
  • payload (NSString/NSDictionary): Payload to send with the push notification. (required)
  • options (NSDictionary): Additional push options.
  • where (NSDictionary): A JSON-encoded object that defines either the user or location query used to select the device that will receive the notification.

handler

Callback to handle the server response. See the Callback section in APSClient. The response data returns the following method-specific properties:

  • push_notification (NSDictionary): Information about the requested push notification: id: The ID of the requested push notification.

Discussion

Sends push notifications to one or more users who are subscribed to a channel.

To use this method, a user must be logged in before calling this method.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

notifyTokens:withBlock:

Sends push notifications to one or more users who are subscribed to a channel.

+ (void)notifyTokens:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • channel (NSString): Name of the channel. (required)
  • to_tokens (NSString): Comma-separated list of device tokens. (required)
  • payload (NSString/NSDictionary): Payload to send with the push notification. (required)
  • options (NSDictionary): Additional push options.
  • where (NSDictionary): A JSON-encoded object that defines either the user or location query used to select the device that will receive the notification.

handler

Callback to handle the server response. See the Callback section in APSClient.

Discussion

Sends push notifications to one or more users who are subscribed to a channel.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

query:withBlock:

Custom query of push notification subscriptions with paginating.

+ (void)query:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • user_id (NSString): User ID of the user who has subscribed devices for push notification. (required)
  • channel (NSString): Name of the push notification channel.
  • device_token (NSString): Apple or Android Device Token.
  • type (NSString): Selects the push type.
  • page (NSNumber): Request page number, default is 1.
  • per_page (NSNumber): Number of results per page, default is 10.

handler

Callback to handle the server response. See the Callback section in APSClient. The response data returns the following method-specific properties:

  • subscriptions (NSDictionary[]): Array of subscription objects, where each subscription object has the following properties: id : String.

Discussion

Custom query of push notification subscriptions with paginating.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

queryChannels:withBlock:

Returns a list of push notification channels the user is subscribed to.

+ (void)queryChannels:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • user_id (NSString): User to retrieve subscribed channels for.
  • page (NSNumber): Request page number, default is 1.
  • per_page (NSNumber): Number of results per page, default is 10.

handler

Callback to handle the server response. See the Callback section in APSClient. The response data returns the following method-specific properties:

  • push_channels (NSString[]): List of subscribed channels.

Discussion

Returns a list of push notification channels the user is subscribed to.

To use this method, a user must be logged in before calling this method.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

resetBadge:withBlock:

Sets the internally stored value of the badge to zero of a specific device.

+ (void)resetBadge:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • device_token (NSString): Device token. (required)

handler

Callback to handle the server response. See the Callback section in APSClient.

Discussion

Sets the internally stored value of the badge to zero of a specific device.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

setBadge:withBlock:

Sets the value of the internally stored value of the badge.

+ (void)setBadge:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • device_token (NSString): Device token.
  • badge_number (NSString): Number to set as the badge on the application’s icon.

handler

Callback to handle the server response. See the Callback section in APSClient.

Discussion

Sets the value of the internally stored value of the badge.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

showChannels:withBlock:

Returns the number of devices subscribed to the specified channel.

+ (void)showChannels:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • name (NSString): Name of the push channel. (required)

handler

Callback to handle the server response. See the Callback section in APSClient. The response data returns the following method-specific properties:

  • devices (NSDictionary): Number of devices subscribed to the channel.

Discussion

Returns the number of devices subscribed to the specified channel.

To use this method, a user must be logged in before calling this method.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

subscribe:withBlock:

Subscribes a mobile device to a push notifications channel.

+ (void)subscribe:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • channel (NSString): Push notification channel to subscribe to. (required)
  • device_token (NSString): Apple or Android Device Token. (required)
  • user_id (NSString): User ID to subscribe on behalf of.

handler

Callback to handle the server response. See the Callback section in APSClient.

Discussion

Subscribes a mobile device to a push notifications channel.

To use this method, a user must be logged in before calling this method.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

subscribeToken:withBlock:

Subscribes a mobile device to a push notifications channel.

+ (void)subscribeToken:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • device_token (NSString): Android or iOS device token. (required)
  • channel (NSString): Name of the channel. (required)
  • type (NSString): Selects the push type.

handler

Callback to handle the server response. See the Callback section in APSClient.

Discussion

Subscribes a mobile device to a push notifications channel.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

unsubscribe:withBlock:

Unsubscribes one of the current user’s devices from a push notification channel.

+ (void)unsubscribe:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • channel (NSString): Name of the push notification channel.
  • device_token (NSString): Apple or Android Device Token. (required)
  • user_id: User ID to unsubscribe from push notifications.

handler

Callback to handle the server response. See the Callback section in APSClient.

Discussion

Unsubscribes one of the current user’s devices from a push notification channel.

To use this method, a user must be logged in before calling this method.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h

unsubscribeToken:withBlock:

Unsubscribes the specified device from a push notification channel.

+ (void)unsubscribeToken:(NSDictionary *)data withBlock:(APSResponseHandler)handler

Parameters

data

Method parameters specified as an NSDictionary with the following key-value pairs:

  • channel (NSString): Name of the push notification channel.
  • device_token (NSString): Android or iOS device token. (required)

handler

Callback to handle the server response. See the Callback section in APSClient.

Discussion

Unsubscribes the specified device from a push notification channel.

For more details about the underlying REST method, see the ACS API Docs.

Declared In

APSPushNotifications.h