• Installs:
  • Today: 48
  • 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 any 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

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
__SING_UP_WITH_GITHUB__
__SING_UP_WITH_FACEBOOK__
__SING_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