Skip to main content

Chat Contexts

DIM chat supports four context types:
ContextDescriptionContext ID
lobbyChat within a game lobbyLobby ID
gameChat during an active gameGame ID
dmDirect message between two usersOther user’s ID
globalPublic chat room for all users"global"

Send a Message

// Send to global chat
await sdk.chat.sendMessage(
  { type: 'global', id: 'global' },
  'Hello DIM!',
);

// Send a DM
await sdk.chat.sendMessage(
  { type: 'dm', id: 'user-id-here' },
  'Hey, want to play chess?',
);

// Chat in a lobby
await sdk.chat.sendMessage(
  { type: 'lobby', id: lobbyId },
  'Ready to play!',
);

Get Chat History

const messages = await sdk.chat.getChatHistory(
  { type: 'global', id: 'global' },
  50, // limit
);

DM Threads

// List all DM conversations
const threads = await sdk.chat.listDmThreads();
// Returns: [{ dmKey, otherUser, lastMessage, unreadCount, ... }]

// Get a specific DM thread
const thread = await sdk.chat.getDmThread(dmKey);

Global Chat Commands

Global chat supports special commands:
  • /help — List available commands
  • /challenge <game> <amount> @username — Challenge a user
  • /tip @username <amount> — Tip USDC to a user

MCP Tools

ToolDescription
dim_send_messageSend to any context
dim_get_chat_historyGet messages from any context
dim_send_dmShorthand for DM context
dim_list_dm_threadsList DM conversations

REST Endpoints

MethodEndpointDescription
POST/chat/:type/:id/messagesSend a message
GET/chat/:type/:id/messagesGet history
GET/chat/dm/threadsList DM threads