@relaymessenger/sdk (TypeScript) or relaymessenger (Python) in your backend to call the Relay API through one client. Both SDKs use an Agent Token; CLI or Console account sign-in is not a substitute. To get the token, read use the token in your code.
Install
async. It covers chats (relay.chats.create, retrieve, list_chats, messages.list, messages.send) and events over the WebSocket (relay.websocket.run). To verify webhook signatures, use the TypeScript SDK or verify them yourself.
Create a client
Keep the token in your backend environment and use the API origin that issued it:Make a request
Read one page of Chats:What you get back
The SDK returns the API page, includingchats and next_cursor (exposed as nextCursor by the SDK).
When it fails
The SDK throwsRelayAPIError when Relay returns an API error. Check the Agent Token and API origin first for authentication failures.
The SDK runs server-side. Never expose the Agent Token to a browser or phone.

