Skip to main content
Install @relaymessenger/sdk in your backend to call the Relay API through one client. The SDK uses an Agent Token; CLI or Console account sign-in is not a substitute.

Install

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