Skip to content
This repository was archived by the owner on Apr 16, 2025. It is now read-only.

Native Push

Mohamad Nour Chawich edited this page Jul 12, 2016 · 15 revisions

WikiAPI ReferenceNotificationsNative Push

Intro

Mobile clients should set Push tokens (APNS / GCM) for all users including guests.

Set and update Profile Push Tokense

When should they be set and unset?

Set

  • After each successful login / signup (including guest login). Simply after a successful /oauth2/access_token
  • After each app open after being completely closed (foreground to background is not included)

Setting Push token will make sure it is transferred from the old owner (if exists) to the new one.

Unset

  • Before logout, which is just before clearing oAuth2 tokens

If this call fails for any reason i.e timed out or got bad response, ignore that and continue the logging out process

##Push Events

event name when data
new_notification got new notification {"app_url": "shoutit://url"}
new_message got new message {"app_url": "shoutit://url"}
incoming_video_call receiving incoming video call {caller Profile object}

Push Object

{
	"event_name": "event name",
	"title": "Example title to display on the notification (android)",
	"body": "Example body to display on the notification (android, iOS)",
	"icon": "Example image to display on the notification (android)",
	"data": {},
	"pushed_for": ""
}
  • Clients should display the title, body and icon (when applicable). API tries to set these attributes for both Android and iOS
  • Clients should open the corresponding screen on new_notification and new_message using data.app_url
    • when there is no app_url or when it is null simply open the app on main screen
  • pushed_for has the id of the profile that the API intended to notify. This is useful when page admins receive Push about their pages. Check Pages Notifications for more details about this case.

References

Clone this wiki locally