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": "[email protected]",
"subject": "Welcome to the team",
"body": "Welcome message...",
"templateId": "tpl_123456789"
}'
{
"data": {
"emailId": "email_123456789",
"to": "[email protected]",
"status": "sent",
"sentAt": "2024-01-22T15:30:00Z"
},
"message": "Email sent successfully",
"status": "success"
}
Send email notifications 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": "[email protected]",
"subject": "Welcome to the team",
"body": "Welcome message...",
"templateId": "tpl_123456789"
}'
{
"data": {
"emailId": "email_123456789",
"to": "[email protected]",
"status": "sent",
"sentAt": "2024-01-22T15:30:00Z"
},
"message": "Email sent successfully",
"status": "success"
}
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": "[email protected]",
"subject": "Welcome to the team",
"body": "Welcome message...",
"templateId": "tpl_123456789"
}'
{
"data": {
"emailId": "email_123456789",
"to": "[email protected]",
"status": "sent",
"sentAt": "2024-01-22T15:30:00Z"
},
"message": "Email sent successfully",
"status": "success"
}
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();
};
Was this page helpful?