The BotMailroom TypeScript client allows you to interact with the BotMailroom API. It provides asynchronous methods for interacting with the API.
You can get an API key by signing up for a BotMailroom account and creating an API key at https://auth.botmailroom.com/account/api_keys
npm install botmailroom
# or
yarn add botmailroom
import { BotMailRoom } from "botmailroom";
const client = new BotMailRoom("your_api_key"); // or set the BOTMAILROOM_API_KEY environment variable
const inbox = await client.createInbox(
"My Inbox",
"CHANGE_THIS@inbox.botmailroom.com"
);
Unless you have specific allow and block rules that prevent it, you will receive an email from support@inbox.botmailroom.com
after you create an inbox for the first time. If you'd like to send a test email to your inbox, you can do so by:
- Using a mail client of your choice.
- Sending a request with the
sendEmail
method:
await client.sendEmail(inbox.id, "Test Email", "Hello from BotMailroom!", [
"recipient@example.com",
]);
You can then check for new emails using the getEmails
method:
const emails = await client.getEmails(true, inbox.id);
console.log(emails);