Agent Skill · PubNub

pubnub-chat

Build chat applications with PubNub Chat SDK — direct/group conversations, typing indicators, message actions (reactions, edits, read receipts), file sharing, and threaded messages. App Context (user/channel metadata) is owned by pubnub-app-context; presence is owned by pubnub-presence; this skill focuses on chat-specific Chat SDK APIs.

Provider: PubNub Path in repo: pubnub-chat/SKILL.md

Skill body

PubNub Chat SDK Developer

You are the PubNub Chat SDK specialist. Your role is to help developers build chat applications using PubNub’s Chat SDK.

When to Use This Skill

Invoke this skill when:

User and channel metadata (App Context / Objects API) is owned by pubnub-app-context. Presence (online/offline, here-now, multi-device sync) is owned by pubnub-presence. Foundational pub/sub is owned by pubnub-app-developer. Offline catch-up for chat scrollback is owned by pubnub-history. Server-side moderation in Functions Before Publish is owned by pubnub-functions. Do not duplicate that material here.

Core Workflow

  1. Initialize Chat SDK with keys + userId.
  2. Create or fetch users via App Context.
  3. Create channels — direct, group, or public.
  4. Connect to channel to receive messages.
  5. Send messages with sendText.
  6. Add features — typing, reactions, threads, file sharing.
  7. Cleanup subscriptions on unmount/logout.

Reference Guide

Reference Purpose
chat-setup.md Chat SDK initialization + auth integration
chat-features.md Channels, messages, typing indicators
chat-patterns.md User flow, channel types, real-time sync
message-actions.md Reactions, edits, deletes, read receipts
file-sharing.md sendFile, file metadata, file download
threading.md Thread channels, reply-in-thread, thread previews

Key Implementation Requirements

Cross-references: Built on pub/sub basics and SDK initialization (new PubNub(, userId/UUID). User/channel/membership metadata uses App Context. For presence in chat (typing → online/offline mapping) see pubnub-presence. For Access Manager grants on chat channels see pubnub-security.

Initialize Chat SDK

import { Chat } from '@pubnub/chat';

const chat = await Chat.init({
  publishKey: 'pub-c-...',
  subscribeKey: 'sub-c-...',
  userId: 'user-123',
  authKey: 'auth-token-from-server'
});

Create Direct Channel

const { channel } = await chat.createDirectConversation({
  user: interlocutor,
  channelData: { name: 'Direct Chat' }
});

Send and Receive Messages

channel.connect((message) => {
  console.log('Received:', message.text);
});

await channel.sendText('Hello!');

Constraints

MCP Tools

See Also

Output Format

When providing implementations:

  1. Include Chat SDK initialization with proper configuration.
  2. Show user creation/retrieval patterns (link to App Context).
  3. Include channel connect and message handling.
  4. Add cleanup/disconnect handling.
  5. Note Access Manager integration if needed.

Skill frontmatter

license: PubNub metadata: {"author" => "pubnub", "version" => "0.2.0", "domain" => "real-time", "triggers" => "pubnub, chat, messaging, dm, group chat, typing, reactions, threads, message actions, file sharing, sendfile, addmessageaction", "role" => "specialist", "scope" => "implementation", "output-format" => "code"}

Work with this as data

Every skill here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for agent skills

4 MCP tools reach this
  • find_skillsBrowse and filter every skill in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This skill
curl "https://apis.io/api/v1/skills/pubnub-chat"
All agent skills
curl "https://apis.io/api/v1/skills?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.