Setting the file. One moment.
Subchapter 157.6
references/zmail-sdk.mdMarkdown5 KBView on GitHub
Integrate with Zoom Mail via REST API and Zoom Apps SDK for mail plugins.
Important: There is no standalone “ZMail JS SDK”. Zoom Mail integration uses:
https://api.zoom.us/v2/emails| Method | Endpoint | Description |
|---|---|---|
| POST | /emails/mailboxes/{email}/messages/send | Send a message |
| POST | /emails/mailboxes/{email}/messages | Create/add message to mailbox |
| POST | /emails/mailboxes/{email}/drafts | Create draft |
| POST | /emails/mailboxes/{email}/labels | Create label |
| GET | /emails/mailboxes/me/profile | Get mailbox profile |
Emails must be in RFC 2822 format, base64 encoded:
// Generate RFC 2822 compliant message
function generateEmailMessage(from, to, subject, body) {
const message = `From: ${from}\nTo: ${to}\nSubject: ${subject}\n\n${body}`;
return btoa(message); // Base64 encode
}
// Send email via API
async function sendEmail(mailbox, toEmail, subject, body) {
const encodedMessage = generateEmailMessage(mailbox, toEmail, subject, body);
const response = await fetch(
`https://api.zoom.us/v2/emails/mailboxes/${mailbox}/messages/send`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
raw: encodedMessage
})
}
);
return response.json();
}
// Usage
await sendEmail(
'sender@company.zmail.com',
'recipient@example.com',
'Meeting Follow-up',
'Thank you for attending today\'s meeting.'
);async function createDraft(mailbox, to, subject, body) {
const encodedMessage = generateEmailMessage(mailbox, to, subject, body);
await fetch(
`https://api.zoom.us/v2/emails/mailboxes/${mailbox}/drafts`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
raw: encodedMessage
})
}
);
}const profile = await fetch(
'https://api.zoom.us/v2/emails/mailboxes/me/profile',
{
headers: { 'Authorization': `Bearer ${accessToken}` }
}
).then(r => r.json());
console.log('Email:', profile.email);Build apps that run inside Zoom Mail tab using Zoom Apps SDK.
npm install @zoom/appssdkOr via CDN:
<script src="https://appssdk.zoom.us/sdk.js"></script>// IMPORTANT: Do NOT declare "let zoomSdk" - causes redeclaration error
// The SDK defines window.zoomSdk globally
let sdk = window.zoomSdk;
async function init() {
try {
const configResponse = await sdk.config({
popout: true,
capabilities: ['insertContentToMailActiveEditor'],
version: '0.16'
});
console.log('Running in context:', configResponse.runningContext);
// Will be "mailTab" when running in Zoom Mail
} catch (error) {
console.error('Not running inside Zoom client:', error);
}
}Insert HTML content into the active mail composer:
// Insert content into mail editor (must comply with Tiptap HTML specs)
await sdk.insertContentToMailActiveEditor({
html: '<p>This content will be inserted into the email body.</p>'
});| Use Case | Description |
|---|---|
| Email Templates | Insert pre-built email templates |
| Signature Manager | Dynamic email signatures |
| Meeting Links | Auto-insert Zoom meeting links |
| CRM Integration | Pull contact info into emails |
| Translation | Translate email content |
async function getAccessToken() {
const response = await fetch('https://zoom.us/oauth/token', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`${clientId}:${clientSecret}`),
'Content-Type': 'application/x-www-form-urlencoded'
},
body: 'grant_type=client_credentials'
});
const data = await response.json();
return data.access_token; // Valid for 1 hour
}| Scope | Description |
|---|---|
mail:read | Read mailbox data |
mail:write | Send emails, create drafts |
mail:read:admin | Admin read access |
mail:write:admin | Admin write access |
| Limitation | Notes |
|---|---|
| Account requirement | Zoom Workplace Pro+ with Zoom Mail |
| Email format | Must be RFC 2822 compliant, base64 encoded |
| Plugin context | Zoom Apps SDK mail features only work in Mail tab |
| HTML in editor | Must comply with Tiptap specifications |