...
Currently, Sunbird email service is used to send the notification to the user on different actions in review workflow. Sunbird uses same default email templates for all workflow actions such as publish, request changes.
...
Default templates will be stored in sunbird middleware(learner service) and configuration for the template will be stored as form config. Default template can also be configured at the installation time using Form API's.
Below are is the sample template configuration for different content review workflows stored in form service.
Publish
{
"request": {
"type": "notification",
"action": "publish",
"subType": "email",
"data": {
"templateName": "publishTemplate",
"publishedTemplate",
"action": "publish",
"fields": [{
"body": "Congratulations! The content that you had submitted has been accepted for publication. It will be available for usage shortly. <br> <br><b> Content <br><br><b>Content Type: </b>{{Content type}}<br> <b> Content Title<br><b>Title: </b>{{Content title}}<br> <b>Content Link<br><b>Link: </b>{{Content link}}<br>",
"subject": "Congratulations, your content is live! Content Type: {{Content type}}, Title: {{Content title}}",
"logo": "https://dev.open-sunbird.org/assets/images/sunbird_logo.png"
}]
}
}
}
Request Changes
{
"request": {
"type": "notification",
"action": "requestChangesrequestForChanges",
"subType": "email",
"data": {
"templateName": "requestForChangesTemplate",
"action": "requestChangesTemplaterequestForChanges",
"fields": [{
"body": "Congratulations! The We acknowledge your contribution and effort in creating content for us. However, we are unable to accept the content that you had submitted has been accepted for publication.It will be available for usage shortly. <br> <br><b> Content .<br> We look forward to a more meaningful relationship with you, the next time around.<br><br><b>Content Type: </b>{{Content type}}<br> <b> Content Title<br><b>Title: </b>{{Content title}}<br> <b>Content Link<br><b>Link: </b>{{Content link}}<br><b>Reviewer name: </b>{{Reviewer name}}<br>",
"subject": "Congratulations, your content is live!Our sincere apologies! Content Type: {{Content type}}, Title: {{Content title}}",
"logo": "https://dev.open-sunbird.org/assets/images/sunbird_logo.png"
}]
}
}
}
Send for Review
{
"request": {
"type": "notification",
"action": "sendforReviewsendForReview",
"subType": "email",
"data": {
"templateName": "sendForReviewTemplate",
"action": "sendforReviewTemplatesendForReview",
"fields": [{
"body": "Congratulations! The content that you had submitted A content has been accepted submitted for publication.It will be available for usage shortly. <br> <br><b> Content review.<br><br><b>Content Type: </b>{{Content type}}<br> <b> Content Title<br><b>Title: </b>{{Content title}}<br> <b>Content Link<br><b>Creator: </b>{{Creator name}}<br><b>Link: </b>{{Content link}}<br>",
"subject": "Congratulations, your content is live!Content has been submitted for review! Content Type: {{Content type}}, Title: {{Content title}}",
"logo": "https://dev.open-sunbird.org/assets/images/sunbird_logo.png"
}]
}
}
}
In the above request,
- type: is the type of form.
- action: workFlow action.
- subType: type of notification.
- templateName: name used to store in Cassandra DB.
- body: Body of the Email.
- subject: subject of Email.
- logo: log used in Email. If not sent default will be used.
...
- {{Content type}}
- {{Content title}}
- {{Content link}}
- {{Creator name}}
- {{Reviewer name}}
Custom templates:
We can also create custom email template channel/tenant specific. If customized templates are not present, the default template will be used to send email for different actions in review workflows.
If any tenants want to configure their own email template, they can do so by adding new email template configurations in Form API and manually inserting the new template in Casandra DB of Sunbird middleware service.
...
- Templates name configured in Form API should be in "slug_workflowAction" format.
- Templates name used to store in Cassandra DB should be same as configured in Form API
- rootOrgId should be added in form API request along with other fields.
- Placeholders should be there in their respective fields.
- If the custom template is configured in form service, then custom template with the same name should also be added in Learner service(sunbird middleware). If not added Learner service will throw an error.
For example, If slug is "sunbird" and action is send for review, template name should be "sunbird_sendforReviewTemplate". Sample custom template configuration.
{
"request": {
"type": "notification",
"action": "sendforReviewsendForReview",
"subType": "email",
"rootOrgId": "0123166367624478721",
"data": {
"templateName": "sendforReviewTemplate",
sendForReviewTemplate",
"action": "sendForReview",
"fields": [{
"body": "Congratulations! The content that you had submitted A content has been accepted submitted for publication.It will be available for usage shortly. <br> <br><b> Content review.<br><br><b>Content Type: </b>{{Content type}}<br> <b> Content Title<br><b>Title: </b>{{Content title}}<br> <b>Content Link<br><b>Creator: </b>{{Creator name}}<br><b>Link: </b>{{Content link}}<br>",
"subject": "Congratulations, your content is live!Content has been submitted for review! Content Type: {{Content type}}, Title: {{Content title}}",
"logo": "https://dev.open-sunbird.org/assets/images/sunbird_logo.png"
}]
}
}
}
Limitation:
- Only predefined placeHolder can be dynamically replaced with content data while sending mail
...