curl -X POST 'https://api.weir.ai/console/mail/send' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"to": "recipient@example.com",
"subject": "Welcome to the team",
"body": "Welcome message...",
"templateId": "tpl_123456789"
}'
{
"data": {
"emailId": "email_123456789",
"to": "recipient@example.com",
"status": "sent",
"sentAt": "2024-01-22T15:30:00Z"
},
"message": "Email sent successfully",
"status": "success"
}
Console APIs - Mail
Send Email
Send email notifications from your organization
POST
/
console
/
mail
/
send
curl -X POST 'https://api.weir.ai/console/mail/send' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"to": "recipient@example.com",
"subject": "Welcome to the team",
"body": "Welcome message...",
"templateId": "tpl_123456789"
}'
{
"data": {
"emailId": "email_123456789",
"to": "recipient@example.com",
"status": "sent",
"sentAt": "2024-01-22T15:30:00Z"
},
"message": "Email sent successfully",
"status": "success"
}
Send Email
Send email notifications to users from your organization.curl -X POST 'https://api.weir.ai/console/mail/send' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-H 'x-source: console' \
-d '{
"to": "recipient@example.com",
"subject": "Welcome to the team",
"body": "Welcome message...",
"templateId": "tpl_123456789"
}'
{
"data": {
"emailId": "email_123456789",
"to": "recipient@example.com",
"status": "sent",
"sentAt": "2024-01-22T15:30:00Z"
},
"message": "Email sent successfully",
"status": "success"
}
Request Body
string
required
Recipient email address.
string
required
Email subject line.
string
Email body content (plain text or HTML).
string
Email template ID to use (optional).
Usage Examples
const sendEmail = async (emailData, accessToken) => {
const response = await fetch('https://api.weir.ai/console/mail/send', {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
'x-source': 'console'
},
body: JSON.stringify(emailData)
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
import requests
def send_email(email_data, access_token):
response = requests.post(
'https://api.weir.ai/console/mail/send',
headers={
'Authorization': f'Bearer {access_token}',
'Content-Type': 'application/json',
'x-source': 'console'
},
json=email_data
)
response.raise_for_status()
return response.json()
Was this page helpful?