Skip to content
TypeScript SDK

Read an agent inbox with the InboxIt SDK

Fetch a test message from one assigned inbox using an agent token with the Reader role.

1. Grant access to one inbox

Create an agent identity in InboxIt Agents and give it the Reader role on one application inbox. Set INBOXIT_AGENT_TOKEN, INBOXIT_AGENT_INBOX_ID and INBOXIT_EXPECTED_SUBJECT. Send a test message with that exact subject from an address you control. The token identifies the workspace.

2. Read the expected message

Copy the files below into your project and run the example. It lists assigned inboxes, checks the Reader role and fetches the message without printing its body.

Example
npm install @inboxit/inboxit-sdk
node examples/agents-read.mjs

3. Check the access boundary

Set INBOXIT_UNASSIGNED_INBOX_ID to another application inbox you own and have left unassigned to this agent. The example then checks that the API denies access to that inbox. Remove the Reader grant or revoke the agent token when the integration is finished.