Skip to main content

Create email pattern

Creates a new email notifier pattern

HTTP Request​

POST/api/notifications/notifiers/email/:id/patterns

Authorization​

Authorization

  • Required: Yes
  • Permission: Staff with EmailPatternsPermission or Admin
  • Permission Code: 2841
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters​

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the email notifier

Request Body​

FieldTypeRequiredDescription
nameStringYesName of the email notifier pattern (unique over the specific email notifier)
descriptionStringNoExtra description about the email notifier pattern
from_emailStringNofrom_email address
subjectStringYesThe subject field of the email
body_textStringYesThe text body of the email pattern
body_htmlStringNoThe html body of the email pattern

Example Requests​

1import requests
2
3# Create a new email notifier
4response = requests.post('http://www.example.com/api/notifications/notifiers/email/1/patterns', 
5  json={
6  "name": "order_status_changed",
7  "description": "used for sending status changes",
8  "from_email": "info@hamgam.online",
9  "subject": "hamgam order status changed",
10  "body_text": "Order number {0} is in {1} status",
11  "body_html": null
12  },
13  headers={'Authorization': 'Token <your_api_key>'}
14)
15print(response.json())

Response Fields​

FieldTypeDescription
idIntegerUnique ID of the email pattern.
nameStringName of the email pattern (unique over the specific email notifier)
descriptionStringExtra descrtiption of the email pattern (nullable)
from_emailStringfrom email of the pattern (nullable)
subjectStringSubject of the email
body_textStringText body of the email pattern
body_htmlStringHtml body of the email pattern (nullable)
created_atString (ISO 8601)Timestamp when the email pattern was created.
updated_atString (ISO 8601)Timestamp when the email pattern was last updated.

Example Response​

{
"id": 3,
"name": "order_status_changed",
"description": "used for sending status changes",
"from_email": "info@hamgam.online",
"subject": "hamgam order status changed",
"body_text": "Order number {0} is in {1} status",
"body_html": null,
"created_at": "2025-12-28T18:14:22.251792Z",
"updated_at": "2025-12-28T18:14:22.251799Z"
}