Set Notification Template

Sets a notification template of the company in the current session. You can check the currently configured value using the Get Notification Template API.

Required Permissions

Requires the Cluster Administrator role.

HTTP Request

POST /api/sonar/push-templates/:type
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d template="$emp_name $emp_title, check your inbox for explanation request email." \
     -X POST \
     https://HOSTNAME/api/sonar/push-templates/sms_explain_req_msg
Request Parameters
Path Parameters
KeyTypeDescriptionNote
typeStringTemplate type
Request Body Parameters
KeyRequiredTypeDescriptionNote
templateNoStringTemplate contentMaximum 16MB. If not specified, null (initialize). For types whose name ends in _body (except mail_ticket_alarm_body), the content is HTML-sanitized before being saved; other types are saved as is without sanitization. Some types support macro substitution (see below)
localeNoStringLanguage codeen, ko, ja, zh

Refer to the below table for available template types:

Template typeDescription
explanation_domainSubmission domain. https://DOMAIN format
mail_explain_req_subjectTitle of explanation request email
mail_explain_req_bodyBody of explanation request email
mail_explain_review_req_subjectTitle of review request email
mail_explain_review_req_bodyBody of review request email
sms_explain_req_msgExplanation request SMS message
sms_explain_review_req_msgReview request SMS message
mail_explain_complete_subjectTitle of explanation completion email
mail_explain_complete_bodyBody of explanation completion email
mail_user_verification_subjectTitle of MFA verification code email
mail_user_verification_bodyBody of MFA verification code email
mail_report_subjectTitle of report email
mail_report_bodyBody of report email
mail_default_bodyDefault mail body (body template used by the sonar-sendmail command, also used as a fallback when the playbook mail body is not configured)
mail_playbook_bodyPlaybook mail body
mail_ticket_alarm_subjectTitle of ticket alarm email
mail_ticket_alarm_bodyBody of ticket alarm email

The following macros apply only to the six mail title/body types mail_explain_req_subject, mail_explain_req_body, mail_explain_review_req_subject, mail_explain_review_req_body, mail_explain_complete_subject, and mail_explain_complete_body, and are substituted with actual values when an explanation request is sent. The macros used by other types depend on the sending logic of the corresponding feature.

MacroDescription
$categoryCategory
$emp_keyEmployee number
$emp_nameEmployee name
$emp_titleEmployee title
$urlSubmission URL
$expire_dateSubmission due date (yyyy-MM-dd)
$expire_timeSubmission due time (HH:mm:ss)
$user_noteUser note in case of auto-request

Success Response

{}

Error Responses

Permission denied

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "no-permission"
}
type is not a supported type code

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "type should be one of explanation_domain, mail_explain_req_subject, mail_explain_req_body, mail_explain_review_req_subject, mail_explain_review_req_body, sms_explain_req_msg, sms_explain_review_req_msg, mail_explain_complete_subject, mail_explain_complete_body, mail_user_verification_subject, mail_user_verification_body, mail_report_subject, mail_report_body, mail_default_body, mail_playbook_body, mail_ticket_alarm_subject, mail_ticket_alarm_body."
}
Unsupported locale value

HTTP status code 500

{
  "error_code": "illegal-state",
  "error_msg": "'de' is unsupported locale."
}