1. Teleboard | Support Center
  2. Solution home
  3. API Documentation
  4. Realtime Push Notifications
Open navigation

Using REST API and PubNub for Realtime Push Notifications

Jump to:



Overview


When enhancing your applications with Telebroad communication services your clients can also benefit from push notifications, giving them real time pop-up alerts about new faxes, voicemails, incoming or missed calls, and SMS messages.


Telebroad use the PubNub real time data stream network provider of the push notifications service. The full functionality of the service is attained with a combination of Telebroad's own APIs and PubNub's console, dashboard, and APKs.


Getting Started The Push/Login API


To get started with push notifications you will use the POST/push/login API request.


webserv.telebroad.com/api/teleconsole/rest/push/login


The linked article provides detailed information, but to summarize the response will return the following relevant fields for the specific user who's authentication credentials are provided:


  • UUID: The Unique ID of the device, entered in the body of the request.

    The UUID can be obtained from the presence window of the Developer Console (see below.)

  • subcribe_key: A subscription key that your application on the user's side needs to provide PubNub to be able to subscribe (that is receive) push notifications from the relevant Telebroad channels.

  • publish_key: A publishing key your application on the server side needs to provide PubNub to be able to publish (that is send) push notifications to the relevant subscribed Telebroad channels.

  • auth: A key that grants a user with administrator abilities for the PubNub Access Manager, for setting tailored channels access security privileges.

  • channels: Details of each channel associated with the specific user's various Telebroad communication assets.

PubNub Channels

Push notification messages are sent to the relevant channel of a specific communication asset (such as a phone line or voicemail). Users receive messages only from the channels they subscribe to. A channels can be accessed by one user exclusively or be shared by a group of users, or an entire company (global channel).

For example a user's fax number will be assigned a specific channel. When the user receives a new fax, the server will send a push notification message to this specific channel informing the subscribed user about it. Since most companies only have one fax number, other users (as a group) can be subscribed to this very same channel to receive real time push notifications about incoming faxes.

PubNub's Developer Console

PubNub's Developer Console allows you to view and debug push notifications events as you develop your application.

Access


Access the console from:


Entering the Keys and Subscribing


Now, depending on what you want to test, enter the relevant subscribe key, publish key, and channel information into the corresponding fields on the console.



Click or tap the SUBSCRIBE button to get connected to the PubNub server. The console will get connected as an anonymous user.



At the very least you must provide the subscribe key to test that users can receive messages. Providing the publish key will also allow you to test sending messages to them. Providing a channel will let you focus on it specifically.  


The origin is the domain for the server that handles the data stream. If you are using a custom domain, enter it here. Otherwise leave it as is.


The auth key must be provided only if the PubNub Access Manager is to be used (see below.) 


In the filter you can enter metadata for each published message. Subscribers are then able to set filter expressions, allowing them to only receive published messages containing specific metadata.


The cipher key is used for encryption and decryption of the data that is sent to PubNub.


To end the current session click   .


Presence


The Presence window shows the channels that are available (present) for delivery and reception of real time push notifications from the console.


If you specify a channel in the subscription screen, only that channel will be present. If you leave the channel field blank all the channels that are associated with the subscription key will be present. 



In addition to the channel information itself, the uuid field details a unique user ID that is generated for each individual device subscribing or publishing. Occupancy tells you how many users are connected to the channel. The action field tells you of real time  events in the channel (possible values are join channel, leave the channel, or change status.)


You can click the circular red arrow icon on the top right to refresh the display.


Messages


Upon subscription this window will notify you about your connection to a channel (or failure to establish connection.)


 


You can now test the functionality of the channel with some relevant communication. Simply call it,  leave a voicemail, or send it an SMS message or a fax.


The messages window will respond immediately with details about the appropriate push notification message.


For example here is an SMS notification including the time it was received in Unix time format, its direction ("dir":"IN" - incoming), the number of the sender ("from") and even the message itself ("msg".)



For a phone call notification we see the start time in Unix time, the status of the call (it was "Answered), its direction,  the name and number of the source (sname and snumber), and the destination number.



You can use as many or as little of these response fields when constructing your application's push notifications.


In this window is also where your debugging practically takes place. The window provides information about any errors pertaining to the subscribed session.


For example here we see a publishing error, indicated as code 403. This could be due to the auth key lacking write permission and need to be addressed by an administrator.



You can click the red stop icon on the top right corner to clear this window (this will also clear he Presence window.)


Publishing a Message


If your account is authorized for publishing you can also test sending a message to users on the subscribed channel.


Simply replace the text in the message window with your own notification text and click the red arrow on the top right corner of the screen.




PubNub Access Manager


Access the PubNub Access Manager by clicking the    button.


Here you can grant or revoke read and write permissions for a specific channel. Start by entering the channel and auth key in the corresponding fields:

  • Secret key: This is use for message authentication as described here.

  • ttl: Stands for time to liveBy default, all granted permissions last 24 hours (1440 minutes). Here you can specify a custom TTL parameter in minutes. A TTL of zero means forever (permanent) until manually revoked.

  • Read?: Checkmark this to select it for granting (or revoking) read permissions.

  • Write?: Checkmark this to select it for granting (or revoking) write permissions.


Click either the GRANT or REVOKE buttons to perform the corresponding action for the channel.


The PubNub Dashboard


When building your own app, you may want to have your own push-notifications for it in addition to the ones provided by Telebroad's communication services. To do that you need to create your own keys from it from the PubNub dashboard.


Access the dashboard from:


You will be taken to the login screen where you can login into an existing account, login with a google account, or sign up for an account with your email.


After you have logged in simply click   and then the newly created app to open the app screen. Here you will see that a key set has already been created for your app, called Demo Keyset. You can create additional sets, each with their own unique properties and permissions, simply by clicking  .

Now click the Demo Keyset to open the key options screen. Here you can copy the keys (icon marked), including the Secret Key. You can view the Secret Key by clicking the eye icon, edit the name of the set with the pen icon, and delete the set with the trashcan icon.


Below the keys themselves are the Application add-ons where you can customize the app with options like Presence, Storage & Playback, Steam Controller, Realtime Analytics, Access Manager (PAM), and even setup Apple, Google, or Microsoft certificates for push notifications. You can read more about these here and here


PubNub's SDKs


Whichever coding language you are using to incorporate Telebraoad's communication services into your app, PubNub provides you with over seventy software development kits to support push notification and data streaming.


Documentation for the software kits is available from:


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article