GraphQL
- Introduction
- Authentication
- Schema
- Customers
- Companies
- Tenants
- Threads
- Tiers
- Events
- Labels
- Messaging
- Pagination
- Error handling
- Error codes
- API Explorer
- Typescript SDK
Reference
- Customer cards
- Webhooks
- Request signing
- mTLS
- UI Components
- Attachments
Messaging
Send new emails
As well as creating outbound emails in the UI you can also send them with the sendNewEmail
API. This is useful for proactively reaching out about issues.
Copy
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.sendNewEmail({
customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95',
threadId: 'th_01HD44FHMCDSSWE38N14FSYV6K',
subject: 'Your account has a problem',
textContent: 'The plain text version of your email goes here.',
markdownContent: 'The markdown **version** of your _email_ goes here.',
});
if (res.error) {
console.error(res.error);
} else {
console.log(res.data);
}
Copy
import { PlainClient } from '@team-plain/typescript-sdk';
const client = new PlainClient({ apiKey: 'plainApiKey_xxx' });
const res = await client.sendNewEmail({
customerId: 'c_01GTC6ZHCMAGR06FMPN9VY5J95',
threadId: 'th_01HD44FHMCDSSWE38N14FSYV6K',
subject: 'Your account has a problem',
textContent: 'The plain text version of your email goes here.',
markdownContent: 'The markdown **version** of your _email_ goes here.',
});
if (res.error) {
console.error(res.error);
} else {
console.log(res.data);
}
Mutation
Copy
mutation sendNewEmail($input: SendNewEmailInput!) {
sendNewEmail(input: $input) {
email {
id
}
error {
message
type
code
}
}
}
Variables
Copy
{
"input": {
"customerId": "c_01GTC6ZHCMAGR06FMPN9VY5J95",
"threadId": "th_01HD44FHMCDSSWE38N14FSYV6K",
"subject": "Your account has a problem",
"textContent": "The plain text version of your email goes here.",
"markdownContent": "The markdown **version** of your _email_ goes here."
}
}
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.