This example verifies the Agent Accounts SDK surface by using the SDK to:
- Create a List and manage its items.
- Create a Rule that references the List.
- Create a Policy that links the Rule.
- Optionally create a Nylas Agent Account grant with
provider: 'nylas'. - Optionally list messages and rule evaluations for an Agent Account grant.
From the examples directory:
npm install
cp .env.example .envSet the common environment variables:
NYLAS_API_KEY=your_nylas_api_key_here
NYLAS_API_URI=https://api.us.nylas.comThis exercises Policies, Rules, and Lists, then cleans them up:
npm run agent-accountsSet an Agent Account grant ID to also verify grant-scoped APIs:
AGENT_ACCOUNT_GRANT_ID=your_agent_account_grant_idThen run:
npm run agent-accountsTo create a new Agent Account, set an email address on a registered domain:
AGENT_ACCOUNT_EMAIL=agent@your-registered-domain.comOptionally enable IMAP/SMTP access by setting:
AGENT_ACCOUNT_APP_PASSWORD=YourSecurePassword123By default, the example cleans up the Policy, Rule, and List it creates, but leaves any newly created Agent Account grant in place. To delete the created grant too:
AGENT_ACCOUNTS_DELETE_CREATED_GRANT=trueTo keep all created resources for inspection:
AGENT_ACCOUNTS_SKIP_CLEANUP=true