Skip to main content
Install @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

The Python SDK installs from the Relay SDK repository, needs Python 3.10 or newer, and its methods are 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, including chats and next_cursor (exposed as nextCursor by the SDK).

When it fails

The SDK throws RelayAPIError 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.

Next steps