For the complete documentation index, see llms.txt. This page is also available as Markdown.

PubNub

Publish real-time messages, inspect history and presence, send mobile push, and grant channel tokens.

Connectors

Choose the connector that matches your authentication method. The options below use the names shown in StackAI.

Connector
Authentication

PubNub Keyset

API key or token

PubNub Keyset

Connect a PubNub keyset with server-side signing credentials.

Set up in PubNub

  1. Prepare the PubNub account or service that the workflow will access. Grant access to the required resources and operations.

  2. Publish Key: Copy the Publish Key from one PubNub keyset in the Admin Portal.

  3. Subscribe Key: Copy the Subscribe Key from the same PubNub keyset.

  4. Secret Key: Copy the Secret Key from the same keyset. It signs server-side requests and must never be exposed to clients.

Set up in StackAI

  1. Open Settings → Connections, add a connection, and select PubNub Keyset.

  2. Enter the credentials and connection details in the fields below.

  3. Save the connection and check its connection status. Select this saved connection when configuring an action or feature that uses it.

Connection fields

StackAI field
Required
What to enter

Publish Key

Yes

Copy the Publish Key from one PubNub keyset in the Admin Portal. Provider instructions.

Subscribe Key

Yes

Copy the Subscribe Key from the same PubNub keyset. Provider instructions.

Secret Key

Yes

Copy the Secret Key from the same keyset. It signs server-side requests and must never be exposed to clients. Provider instructions.

Server User ID

Optional / as applicable

Stable user ID used to identify this StackAI connection in PubNub usage and Access Manager.

Verify the connection

Check that the connection is healthy. Then run a read operation against a resource the connected account can access. A successful connection check confirms authentication; it does not guarantee permission for every action.

If access is denied, check the credential or OAuth permissions, the selected account or environment, and access to the specific resource. Update expired credentials or reconnect after permissions change.

Use an action

  1. Add the required PubNub action to the workflow.

  2. Select a connection when the action requests one.

  3. Complete the required fields. Use the reference picker when a value comes from another workflow step.

  4. Run the workflow and inspect the action’s output. Check the result before using it in a later step.

Actions

Publish Message

Publish a JSON message to a PubNub channel.

Inputs

Field
Type
Required
Description

Channel

select (string)

Yes

Channel that receives the message. Options load from the selected connection.

Message

object

Yes

JSON message to publish, below 32 KiB.

Store in History

boolean

No

Save the message when Message Persistence is enabled. Default: true.

Outputs

Field
Type
Description

Channel

string

Channel that received the message.

Timetoken

string

PubNub publish timetoken.

Stored

boolean

Whether storage was requested.

Fetch Message History

Fetch stored messages from one PubNub channel.

Inputs

Field
Type
Required
Description

Channel

select (string)

Yes

Channel whose stored messages should be fetched. Options load from the selected connection.

Messages

number

No

Number of messages to return, up to 100. Default: 25.

Start Timetoken

string

No

Fetch messages older than this timetoken.

End Timetoken

string

No

Optional inclusive older boundary.

Outputs

Field
Type
Description

Messages

object_array

Stored messages in chronological order.

Next Start Timetoken

string

Cursor for the next older page.

Get Presence

See who is currently present on a PubNub channel.

Inputs

Field
Type
Required
Description

Channel

select (string)

Yes

Channel whose current occupants should be returned. Options load from the selected connection.

Include State

boolean

No

Include each occupant's ephemeral presence state. Default: false.

Occupants

number

No

Maximum occupants to return, up to 1,000. Default: 100.

Offset

number

No

Zero-based occupant offset. Default: 0.

Outputs

Field
Type
Description

Occupancy

integer

Total users currently present.

Occupants

object_array

Users returned in this page.

Next Offset

integer

Offset for the next page.

Send Push Notification

Send an FCM or APNs notification through PubNub Mobile Push.

Inputs

Field
Type
Required
Description

Channel

select (string)

Yes

Channel whose registered devices receive the push. Options load from the selected connection.

Title

string

Yes

Push notification title.

Body

textarea

Yes

Push notification message.

Platform

select (string)

No

Mobile push provider to target. Available values: Firebase (FCM), Apple (APNs), Firebase and Apple. Default: fcm.

APNs Topic

string

No

Apple app bundle ID, required for APNs.

APNs Environment

select (string)

No

Apple push environment. Defaults to development. Available values: Development, Production.

APNs Authentication

select (string)

No

Apple credential type configured on the PubNub keyset. Defaults to token. Available values: Authentication Token, Certificate.

Store in History

boolean

No

Save the push payload in channel history. Default: false.

Outputs

Field
Type
Description

Channel

string

Channel used for mobile push delivery.

Timetoken

string

PubNub publish timetoken.

Platform

string

Push provider targeted.

Grant Access Token

Create a time-limited PubNub Access Manager token for one channel.

Inputs

Field
Type
Required
Description

Channel

select (string)

Yes

Channel covered by the access token. Options load from the selected connection.

Lifetime (Minutes)

number

No

Token lifetime from 1 minute to 30 days. Default: 60.

Read

boolean

No

Allow subscribing, presence, and message history reads. Default: true.

Write

boolean

No

Allow publishing to the channel. Default: false.

Authorized User ID

string

No

Restrict the token to one PubNub user ID.

Outputs

Field
Type
Description

Access Token

string

Signed PubNub access token.

Channel

string

Channel covered by the token.

Lifetime (Minutes)

integer

Requested token lifetime.

Important behavior

Actions that create, update, send, or delete data can change the connected service. Review their inputs before running them. A retry can repeat an operation; consider this when configuring retries for actions that change data.

The catalog lists the fields and capabilities available in the supplied provider definition. Availability can also depend on your deployment and organization’s Feature Access settings.

Last updated

Was this helpful?