Skip to content

Docs / Quickstart

Run your first query

Ask for the mail your app needs, send a person through the consent screen, and read what they approved. This takes about ten minutes, using a sandbox mailbox with sample mail.

Create an app in the developer console and copy its test key. Test keys only see sandbox mailboxes.

npm install @permaily/sdk

Request the smallest access that does the job. Your query says which emails you want, and the response gives you a link to the consent screen.

const { consentUrl, access } = await permaily.access.request({
query:
"from:(iberia.com OR booking.com OR renfe.es OR airbnb.com) " +
"subject:(booking OR reservation OR itinerary)",
parts: ["headers", "body_text"],
actions: ["read"],
expiresIn: "90d",
});

They see the exact emails you’d receive, on their own mail, then come back to your redirect address.

Every message carries its receipt id, and only the parts in the access.

for await (const message of permaily.messages.list({ access })) {
console.log(message.subject, message.receipt);
}