Template Approval Workflow
Learn how to build an approval workflow for publishing templates
Flow
A notification template is changed and submitted for review. Upon submission, an outbound webhook call will be made that will notify of a pending change submission. Upon receipt of the webhook event, a review and approval process can run and then publish the template via API call.
Diagram
Enable Notification Checks for a Template
Checks need to be enabled for each template you want to require an approval workflow for.
- Open the notification template
- Click the Settings gear
- Navigate to the Checks tab
- Enable custom checks
The template’s publish button will be replaced with an option to send it for review.
After a template has been sent for review, it will enter a Read Only state where no changes can be made to the latest draft. Users can cancel the submission to restore the template to a draft state and make additional changes.
Sending a template for review emits a webhook event with type “notification:submitted”.
Webhooks
Configure a webhook in Settings → Webhooks. This webhook will be called when a notification is submitted for a review, when it was canceled and also when a notification is published. Please note: At this point we do not have a granular way to allocate webhooks so you will receive other events (message sent events) for the webhooks you add to the Settings, so filter on the event type.
Webhook Settings
Edit Webhook Dialog
Event Types
To see examples of other notification submission event types, review the webhook documentation.
Once you have received a notification:submitted event, you can trigger an approval workflow that runs outside of Courier. Once the workflow is complete and the template is approved to be published, see Publishing the template.
Fetching Content (Optional)
When the “notification:submitted” event is received, the content can be retrieved by calling the Notification Content API. The response can be used to include additional details or template content in your approval workflow.
GET /notifications/:notification_id/draft/content
Sample Template
Sample Template
Sample Template Response
Checksum
We md5 hash the contents for each block, channel and notification so you could track if contents have ever changed in order to manage translations workflow as needed.
Publishing the template
Once all checks are resolved, Courier can be notified that the process is completed and release the template to be published.
PUT /notifications/:notification_id/:submission_id/checks
If you wish to reject a request to publish a template, see Cancel a submission. The check status can be set to FAILED
or PENDING
using PUT as well, which can be used for more complex state management in approval workflows.
Fetching Checks
Checks API GET endpoint
GET /notifications/:notification_id/:submission_id/checks
Example - GET /notifications/SFTYJKSF0241SVH2TWY97TTFFTQG/1630424150210/checks
Cancel a Submission
A request to publish a template can be cancelled by deleting the submission. This will move the template back to a draft state. Checks for the submission will also be updated to a FAILED state. Once a submission has been cancelled, setting the check to RESOLVED will not publish that submission.
DELETE /notifications/:notification_id/:submission_id/checks
Submitted Keys
Submitted keys are used when you have to send a notification that was submitted for a review but maybe not ready to be published. Basically, submitted is an interim state between Draft and Published. Here’s how it works -
→ If notification was published, a submitted key send operation uses published notification contents
→ If notification was submitted for review, a submitted key send operation uses latest draft notification content
Submitted keys can be retrieved, updated or deleted from the Settings → API Keys UI.