• Installs:
  • Today: 48
  • This Week: 428
  • This Month: 1488
  • All Time: 22101
Developer:userdimashirokov

PubNub API Package

Apply real-time publish/subscribe messaging to your program.

List of Endpoints
This is the list of endpoints this API includes. To add of the endpoints to your app, please click on “Connect to endpoint” text.
See All
List of Webhook Events
This is the list of webhook events this API provides. Webhooks allow you to register to certain events and receive real-time data over websockets.
See All
Discussions
See All
Readme

PubNub

PubNub Package

The PubNub Package can be used to build real time application based on the PubNub platform.

  • Domain: pubnub.com
  • Credentials: subscribeKey, publishKey, cipherKey, authKey

How to get credentials:

  1. Login to PubNub
  2. Enter a new app name and click on <kbd>Create new app</kbd> Creating new app
  3. Choose new app and <kbd>Create new keyset</kbd>
  4. Copy and save your keyset credentials
  5. Choose click on new keyset and enable PRESENSE, STORAGE & PLAYBACK Enable

TOC:

<a name="publishMessage"/>

PubNub.publishMessage

Send a message to all channel subscribers.

FieldTypeDescription
publishKeycredentialsThe publish key obtained from PubNub.
subscribeKeycredentialsThe subscribe key obtained from PubNub.
messageJOSNThe destination of the message. Example: {"text": "Hello world"}
cipherKeyStringIf passed, will encrypt the payloads.
authKeyStringIf PAM enabled, this key will be used on all requests.
uuidStringUUID to use, if not passed, a random will be generated.
channelStringPublish extra meta with the request.
storeInHistoryStringThis parameter overrides default account configuration on message saving. true to Save, false to not save. Default is true.
sendByPostStringIf true the messages are stored in history. true to send via post. Default is false.
metaJSONPublish extra meta with the request. Example: {"cool": "meta"}

Request example

{   "publishKey": "...",
    "subscribeKey": "...",
    "message": {"text": "Hello World!"}
}

Response example

{
    "callback":"success",
    "contextWrites":{
        "#":{
            "to":"Timetoken: 14744516634751170c"
        }
    }
}

<a name="hereNow"/>

PubNub.hereNow

Method description

FieldTypeDescription
subscribeKeycredentialsThe subscribe key obtained from PubNub.
cipherKeyStringIf passed, will encrypt the payloads.
channelsArraySpecifies the channel name to return occupancy results. If channel is not provided, hereNow() will return data for all channels. (ch1, ch2, ch3)
channelGroupsArrayThe channel group for which here now information should be received. (ch1, ch2, ch3)
includeStateStringSetting state to true enables the return of subscriber state information. Default is false

Request example

{   "subscribeKey": "...",
    "channels": "ch1, ch2",
    "includeState": true
}

Response example

{
    "callback":"success",
    "contextWrites":{
        "#":{
            "to": {
                "status" : 200,
                "message" : "OK",
                "service" : "Presence",
                "uuids" : [
                    {
                        "uuid" : "myUUID0"
                    },
                    {
                        "state" : {
                            "abcd" : {
                                "age" : 15
                            }
                        },
                        "uuid" : "myUUID1"
                    },
                    {
                        "uuid" : "b9eb408c-bcec-4d34-b4c4-fabec057ad0d"
                    },
                    {
                        "state" : {
                            "abcd" : {
                                "age" : 15
                            }
                        },
                        "uuid" : "myUUID2"
                    },
                    {
                        "state" : {
                            "abcd" : {
                                "age" : 24
                            }
                        },
                        "uuid" : "myUUID9"
                    }
                ],
                "occupancy" : 5
            }
        }
    }
}

<a name="whereNow"/>

PubNub.whereNow

Method description

FieldTypeDescription
subscribeKeycredentialsThe subscribe key obtained from PubNub.
cipherKeyStringIf passed, will encrypt the payloads.
authKeyStringIf PAM enabled, this key will be used on all requests.
uuidStringUUID to use, if not passed, a random will be generated.

Request example

{   "subscribeKey": "...",
    "cipherKey": "...",
    "authKey": "...",
    "uuid": "..."
}

Response example

{
    "callback":"success",
    "contextWrites":{
        "#":{
            "to": {
                "channels": {
                    "ch1": {
                        "occupancy": 1,
                        ...
                    },
                    "ch2": {
                        "occupancy": 1,
                        ...
                    }
                }
            }
        }
    }
}

<a name="getUserState"/>

PubNub.getUserState

Method description

FieldTypeDescription
subscribeKeycredentialsThe subscribe key obtained from PubNub.
cipherKeyStringIf passed, will encrypt the payloads.
authKeyStringIf PAM enabled, this key will be used on all requests.
uuidStringUUID to use, if not passed, a random will be generated.
channelsArraySpecifies the channel name to return occupancy results. If channel is not provided, hereNow() will return data for all channels. (ch1, ch2, ch3)
channelGroupsArrayThe channel group for which here now information should be received. (ch1, ch2, ch3)

Request example

{   "subscribeKey": "...",
    "uuid": "UID123",
    "channels": "ch1, ch2",
}

Response example

{
    "callback":"success",
    "contextWrites":{
        "#":{
            "to": {
                "channels": {
                    "ch1": {
                        "occupancy": 1,
                        ...
                    },
                    "ch2": {
                        "occupancy": 1,
                        ...
                    }
                }
            }       
        }
    }
}
x
circle
PubNub
$ / m
We will charge your card every month for the plan amount, as well as any overages incurred in the previous month.
?

Oops, we are missing some details

Looks like there are a few missing details that you haven't filled in yet.
These details are important and will help us protect you and let you know about anything new.

x

Connect your app to APIs via RapidAPI

Consume and monitor multiple APIs through the RapidAPI SDK.
Click start to set up your app and connect to your first API.

START

Give your app a name

This app will be used in RapidAPI to collect and connect all the APIs you need.

NEXT

Connect your project

Choose your backend language and then install & require the RapidAPI SDK.

  • node
    NodeJS
  • php
    PHP
  • python
    Python
  • objc
    Obj-C
  • android
    Android
  • go
    GO
  • ruby
    Ruby
  • csharp
    C#

Install SDK

Run the following command to install the SDK:

npm install rapidapi-connect --save

Require SDK

In your code, add the following code to require the RapidAPI SDK:

NEXT

Hooray! You are connected

Use the following code to try it out by getting all the APIs that are on RapidAPI.

rapid.call('RapidAPI', 'getAll', {'{}'});
FINISH
esccloses this view
x

Login to RapidAPI

Create endpoints based on popular APIs and share with others.
Follow popular APIs and get updated. Stand out in the community of developers.

LOG INSIGN UP
Login with Github
Login with Facebook
Login with Google
Or
Remember Me

  • We're not going to post anything on your wall.
  • We're not planning to spam you.
  • esccloses this view
    x

    Why sign up to RapidAPI?

    • integrate
      Integrate APIs into your app
      Ruby, Java, Elixir, Node.js, Phyton, Objective C, Swift, PHP and MORE
    • keys
      Save all API keys in one place
    • notifications
      Get notifications about API changes
    • stats
      Get stats and monitor API connections
    Sign up with Github
    Sign up with Facebook
    Sign up with Google
  • We're not going to post anything on your wall.
  • We're not planning to spam you.
  • esccloses this view
    x

    Authentication

    Authenticate
    esccloses this view