curl -X PUT 'https://api.weir.ai/mail/template/tpl_123456789' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Updated Welcome Email",
"subject": "Welcome to Weir AI Platform",
"body": "<html>Updated content...</html>"
}'
{
"data": {
"templateId": "tpl_123456789",
"updatedAt": "2024-01-22T15:30:00Z"
},
"message": "Template updated successfully",
"status": "success"
}
Update an existing email template
curl -X PUT 'https://api.weir.ai/mail/template/tpl_123456789' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Updated Welcome Email",
"subject": "Welcome to Weir AI Platform",
"body": "<html>Updated content...</html>"
}'
{
"data": {
"templateId": "tpl_123456789",
"updatedAt": "2024-01-22T15:30:00Z"
},
"message": "Template updated successfully",
"status": "success"
}
curl -X PUT 'https://api.weir.ai/mail/template/tpl_123456789' \
-H 'Authorization: Bearer YOUR_ADMIN_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "Updated Welcome Email",
"subject": "Welcome to Weir AI Platform",
"body": "<html>Updated content...</html>"
}'
{
"data": {
"templateId": "tpl_123456789",
"updatedAt": "2024-01-22T15:30:00Z"
},
"message": "Template updated successfully",
"status": "success"
}
const updateMailTemplate = async (templateId, updateData, accessToken) => {
const response = await fetch(`https://api.weir.ai/mail/template/${templateId}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
return await response.json();
};
Was this page helpful?