Here you can see API endpoints related to notifications.
You can see all the API endpoints with examples of requests and responses in the Amelia API Postman collection which you can download here.
Authorization
All Amelia endpoints use an API key authorization, using the header property named “Amelia”.
Path
Amelia API paths start with: {{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
Add notification
Create a custom notification.
Method
This endpoint accepts POST requests.
Path
/notification
Required Properties
The following properties are required.
Key | Type | Description |
---|---|---|
name | string | The name which defines the type of notification ({customer/provider}_{appointment/event/package}_{approved/canceled/pending/rejected}) |
customName | string | The name of the notification which is visible in the backend |
type | string | The type of the notification. Possible values: “email”, “sms”, “whatsapp” |
sendTo | string | The user type of the notification. Possible values: “customer”, “provider” |
entity | string | The entity for which to send the notification. Possible values: “appointment”, “event” |
subject | string | The subject of the notification or a list of placeholders separated by comma in case of whatsapp for the template header. |
content | string | The body of the notification or a list of placeholders separated by comma in case of whatsapp for the template body. |
Optional Properties
The following properties are optional
Key | Type | Description |
---|---|---|
status | string | The status of the notification. Possible values: “enabled”, “disabled”. The default value is “enabled” |
sendOnlyMe
|
boolean | Whether the default notification should be sent as well. The default value is true. |
time
|
string | The time when to send the notification if it is a scheduled notification. |
timeBefore
|
integer | The time before the appointment when the notification should be sent in seconds. |
timeAfter
|
integer | The time after the appointment when the notification should be sent in seconds. |
entityIds
|
array | An array of entity (service or event) ids for which to send the notification. By default it is sent for all. |
whatsAppTemplate
|
string | The whatsapp template. Required if the type of the notification is “whatsapp” |
minimumTimeBeforeBooking
|
object | An object with properties: amount and period, which defines the minimum time between the booking date and it;s start, for a scheduled notification to be sent. |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications' \ --header 'Content-Type: application/json' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \ --data '{ "name": "customer_appointment_approved", "customName": "Custom notification", "type": "email", "sendTo": "customer", "entity": "appointment", "sendOnlyMe": false, "status": "enabled", "time": null, "timeBefore": null, "timeAfter": null, "entityIds": [ 1 ], "subject": "%service_name% Notification Subject", "content": "<p>Dear <strong>%customer_full_name%</strong>, </p><p><br></p><p>Notification Content</p><p><br></p><p>Thank you for choosing our company, </p><p><strong>%company_name%</strong></p>", "whatsAppTemplate": "", "minimumTimeBeforeBooking": null }'
{ "message": "Successfully added notification.", "data": { "notification": { "id": 123, "name": "customer_appointment_approved", "customName": "Custom notification", "status": "enabled", "type": "email", "entity": "appointment", "time": null, "timeBefore": null, "timeAfter": null, "sendTo": "customer", "subject": "%service_name% Notification Subject", "content": "<p>Dear <strong>%customer_full_name%</strong>, </p><p><br></p><p>Notification Content</p><p><br></p><p>Thank you for choosing our company, </p><p><strong>%company_name%</strong></p>", "translations": null, "entityIds": [ 1 ], "sendOnlyMe": null, "whatsAppTemplate": null, "minimumTimeBeforeBooking": null }, "update": false, "id": "123" } }
Update notification
Update notification details.
Method
This endpoint accepts POST requests.
Path
/notifications/{{notification_id}}
Optional Properties
Send only the properties you want updated.
Key | Type | Description |
---|---|---|
name | string | The name which defines the type of notification ({customer/provider}_{appointment/event/package}_{approved/canceled/pending/rejected}) |
customName | string | The name of the notification which is visible in the backend |
type | string | The type of the notification. Possible values: “email”, “sms”, “whatsapp” |
sendTo | string | The user type of the notification. Possible values: “customer”, “provider” |
entity | string | The entity for which to send the notification. Possible values: “appointment”, “event” |
subject | string | The subject of the notification or a list of placeholders separated by comma in case of whatsapp for the template header. |
content | string | The body of the notification or a list of placeholders separated by comma in case of whatsapp for the template body. |
sendOnlyMe
|
boolean | Whether the default notification should be sent as well. The default value is true. |
time
|
string | The time when to send the notification if it is a scheduled notification. |
timeBefore
|
integer | The time before the appointment when the notification should be sent in seconds. |
timeAfter
|
integer | The time after the appointment when the notification should be sent in seconds. |
entityIds
|
array | An array of entity (service or event) ids for which to send the notification. By default it is sent for all. |
whatsAppTemplate
|
string | The whatsapp template. Required if the type of the notification is “whatsapp” |
minimumTimeBeforeBooking
|
object | An object with properties: amount and period, which defines the minimum time between the booking date and it;s start, for a scheduled notification to be sent. |
status | string | The status of the notification. Possible values: “enabled”, “disabled”. The default value is “enabled” |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications/123' \ --header 'Content-Type: application/json' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \ --data '{ "name": "customer_appointment_approved", "customName": "Custom notification new name", "type": "email", "sendTo": "customer", "entity": "appointment", "sendOnlyMe": false, "status": "enabled", "time": null, "timeBefore": null, "timeAfter": null, "entityIds": [ 1, 2 ], "subject": "%service_name% Notification Subject", "content": "<p>Dear <strong>%customer_full_name%</strong>, </p><p><br></p><p>Notification Content</p><p><br></p><p>Thank you for choosing our company, </p><p><strong>%company_name%</strong></p>", "whatsAppTemplate": "", "minimumTimeBeforeBooking": null }'
{ "message": "Successfully updated notification.", "data": { "notification": { "id": 123, "name": "customer_appointment_approved", "customName": "Custom notification new name", "status": "enabled", "type": "email", "entity": "appointment", "time": null, "timeBefore": null, "timeAfter": null, "sendTo": "customer", "subject": "%service_name% Notification Subject", "content": "<p>Dear <strong>%customer_full_name%</strong>, </p><p><br></p><p>Notification Content</p><p><br></p><p>Thank you for choosing our company, </p><p><strong>%company_name%</strong></p>", "translations": null, "entityIds": [ 1, 2 ], "sendOnlyMe": null, "whatsAppTemplate": null, "minimumTimeBeforeBooking": null }, "update": false, "id": "123" } }
Get notifications
Retrieve notifications and whatsapp templates.
Method
This endpoint accepts GET requests.
Path
/notifications
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully retrieved notification.", "data": { "notifications": [ { "id": 123, "name": "customer_appointment_approved", "customName": "Custom notification new name", "status": "enabled", "type": "email", "entity": "appointment", "time": null, "timeBefore": null, "timeAfter": null, "sendTo": "customer", "subject": "%service_name% Notification Subject", "content": "<p>Dear <strong>%customer_full_name%</strong>, </p><p><br></p><p>Notification Content</p><p><br></p><p>Thank you for choosing our company, </p><p><strong>%company_name%</strong></p>", "translations": null, "entityIds": [ 1, 2 ], "sendOnlyMe": null, "whatsAppTemplate": null, "minimumTimeBeforeBooking": null } ], "whatsAppTemplates" : [ { "name": "appointment_rejected", "components": [ { "type": "BODY", "text": "Dear {{1}},\n\nYour {{2}} appointment, scheduled on {{3}} at {{4}} has been rejected." }, { "type": "FOOTER", "text": "appointment rejected" } ], "language": "en", "status": "APPROVED", "category": "UTILITY", "id": "1524182254713483" }, { "name": "appointment_reminder", "components": [ { "type": "HEADER", "format": "TEXT", "text": "reminder" }, { "type": "BODY", "text": "Hi {{1}} ,\n\nYou have one confirmed {{2}} appointment at {{3}} on {{4}} at {{5}}. The appointment is added to your schedule." }, { "type": "FOOTER", "text": "appointment reminder" } ], "language": "en_US", "status": "APPROVED", "category": "UTILITY", "id": "1385060198655925" } ] } }
Get sms history
Get sms history.
Method
This endpoint accepts GET requests.
Path
/notifications/sms/history
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications/sms/history' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully retrieved notifications.", "data": { "notifications": [ { "id": 23, "notificationId": 15, "userId": 2, "appointmentId": 762, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Test,\n\nYou have successfully scheduled amelia service appointment with Milica2 Employee2. We are waiting for you at 169 W North Ave, Northlake, IL, USA on October 10, 2023 9:30 am.\n\nThank you for choosing our company,\n", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 22, "notificationId": 15, "userId": 16, "appointmentId": 756, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Amelia Test,\n\nYou have successfully scheduled amelia service appointment with Amelia Employee. We are waiting for you at Velisava Vulovića 18, Belgrade, Serbia on October 10, 2023 12:30 am.\n\nThank you for choosing our company,\n", "phone": "0601234567", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Amelia Test" }, { "id": 21, "notificationId": 15, "userId": 16, "appointmentId": 755, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Amelia Test,\n\nYou have successfully scheduled amelia service appointment with Amelia Employee. We are waiting for you at Velisava Vulovića 18, Belgrade, Serbia on October 17, 2023 12:30 am.\n\nThank you for choosing our company,\n", "phone": "0601234567", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Amelia Test" }, { "id": 20, "notificationId": 23, "userId": 1, "appointmentId": 480, "eventId": null, "packageCustomerId": null, "logId": 67967, "dateTime": "2023-07-28 16:55:58", "text": "Hi Milica Employee,\n \nYou have one confirmed new service appointment at mARSALA tITA 96 on August 2, 2023 at 2:00 pm. The appointment is added to your schedule.\n \nThank you,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "queued", "price": 0, "segments": 2, "userFullName": "Milica Employee" }, { "id": 19, "notificationId": 15, "userId": 2, "appointmentId": 480, "eventId": null, "packageCustomerId": null, "logId": 67966, "dateTime": "2023-07-28 16:55:28", "text": "Dear Milica Snake,\n\nYou have successfully scheduled new service appointment with Milica Employee. We are waiting for you at Marsala Tita 96, Visnjica on August 2, 2023 2:00 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "queued", "price": 0, "segments": 2, "userFullName": "Milica Test" }, { "id": 18, "notificationId": 23, "userId": 1, "appointmentId": 479, "eventId": null, "packageCustomerId": null, "logId": 67965, "dateTime": "2023-07-28 16:52:56", "text": "Hi Milica Employee,\n \nYou have one confirmed amelia service appointment at 169 West Drive on August 15, 2023 at 9:30 am. The appointment is added to your schedule.\n \nThank you,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "queued", "price": 0, "segments": 2, "userFullName": "Milica Employee" }, { "id": 17, "notificationId": 15, "userId": 2, "appointmentId": 479, "eventId": null, "packageCustomerId": null, "logId": 67964, "dateTime": "2023-07-28 16:52:18", "text": "Dear Milica Snake,\n\nYou have successfully scheduled amelia service appointment with Milica Employee. We are waiting for you at on August 15, 2023 9:30 am.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "queued", "price": 0, "segments": 2, "userFullName": "Milica Test" }, { "id": 16, "notificationId": 23, "userId": 1, "appointmentId": 478, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Hi Milica Employee,\n \nYou have one confirmed amelia service appointment at mARSALA tITA 96 on August 7, 2023 at 6:30 pm. The appointment is added to your schedule.\n \nThank you,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Employee" }, { "id": 15, "notificationId": 15, "userId": 46, "appointmentId": 478, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Amelia Test,\n\nYou have successfully scheduled amelia service appointment with Milica Employee. We are waiting for you at Marsala Tita 96, Visnjica on August 7, 2023 6:30 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Amelia Test" }, { "id": 14, "notificationId": 23, "userId": 1, "appointmentId": 478, "eventId": null, "packageCustomerId": null, "logId": 67963, "dateTime": "2023-07-28 16:15:09", "text": "Hi Milica Employee,\n \nYou have one confirmed amelia service appointment at mARSALA tITA 96 on August 7, 2023 at 6:30 pm. The appointment is added to your schedule.\n \nThank you,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "delivered", "price": 0.0113, "segments": 2, "userFullName": "Milica Employee" }, { "id": 13, "notificationId": 15, "userId": 2, "appointmentId": 478, "eventId": null, "packageCustomerId": null, "logId": 67962, "dateTime": "2023-07-28 16:14:08", "text": "Dear Milica Snake,\n\nYou have successfully scheduled amelia service appointment with Milica Employee. We are waiting for you at Marsala Tita 96, Visnjica on August 7, 2023 6:30 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "delivered", "price": 0.0225, "segments": 2, "userFullName": "Milica Test" }, { "id": 12, "notificationId": 23, "userId": 1, "appointmentId": 477, "eventId": null, "packageCustomerId": null, "logId": 67961, "dateTime": "2023-07-28 16:02:58", "text": "Hi Milica Employee,\n \nYou have one confirmed amelia service appointment at 169 West Drive on August 1, 2023 at 3:30 pm. The appointment is added to your schedule.\n \nThank you,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "delivered", "price": 0.0818, "segments": 2, "userFullName": "Milica Employee" }, { "id": 11, "notificationId": 15, "userId": 2, "appointmentId": 477, "eventId": null, "packageCustomerId": null, "logId": 67960, "dateTime": "2023-07-28 16:02:14", "text": "Dear Milica Snake,\n\nYou have successfully scheduled amelia service appointment with Milica Employee. We are waiting for you at on August 1, 2023 3:30 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "delivered", "price": 0.102, "segments": 2, "userFullName": "Milica Test" }, { "id": 10, "notificationId": 15, "userId": 2, "appointmentId": 432, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Snake,\n\nYou have successfully scheduled amelia service appointment with Amelia Employee. We are waiting for you at on August 1, 2023 12:00 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 9, "notificationId": 15, "userId": 2, "appointmentId": 458, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Snake,\n\nYou have successfully scheduled new service appointment with Amelia Employee. We are waiting for you at on July 24, 2023 1:30 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 8, "notificationId": 15, "userId": 18, "appointmentId": 420, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Ivana Nikolic,\n\nYou have successfully scheduled amelia service appointment with New Employee. We are waiting for you at Marsala Tita 96, Visnjica on August 1, 2023 11:00 am.\n\nThank you for choosing our company,\nAmelia", "phone": "+3816316526565", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Ivana Nikolic" }, { "id": 7, "notificationId": 15, "userId": 16, "appointmentId": 329, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Amelia Test,\n\nYou have successfully scheduled milica2 service appointment with Milica2 Employee2. We are waiting for you at Marsala Tita 96, Visnjica on June 30, 2023 11:30 am.\n\nThank you for choosing our company,\nAmelia", "phone": "+381601234567", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Amelia Test" }, { "id": 6, "notificationId": 15, "userId": 2, "appointmentId": 325, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Snake,\n\nYou have successfully scheduled new service appointment with Milica Employee. We are waiting for you at Marsala Tita 96, Visnjica on July 11, 2023 9:30 am.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 5, "notificationId": 15, "userId": 2, "appointmentId": 324, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Snake,\n\nYou have successfully scheduled milica2 service appointment with Milica2 Employee2. We are waiting for you at Marsala Tita 96, Visnjica on July 3, 2023 1:30 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 4, "notificationId": 15, "userId": 2, "appointmentId": 324, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Snake,\n\nYou have successfully scheduled milica2 service appointment with Milica2 Employee2. We are waiting for you at Marsala Tita 96, Visnjica on July 3, 2023 1:30 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 3, "notificationId": 15, "userId": 2, "appointmentId": 324, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Snake,\n\nYou have successfully scheduled milica2 service appointment with Milica2 Employee2. We are waiting for you at Marsala Tita 96, Visnjica on July 3, 2023 1:30 pm.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 2, "notificationId": 15, "userId": 2, "appointmentId": 323, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Milica Snake,\n\nYou have successfully scheduled milica2 service appointment with Milica2 Employee2. We are waiting for you at Marsala Tita 96, Visnjica on July 4, 2023 9:00 am.\n\nThank you for choosing our company,\nAmelia", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Milica Test" }, { "id": 1, "notificationId": 15, "userId": 10, "appointmentId": 124, "eventId": null, "packageCustomerId": null, "logId": null, "dateTime": "2023-11-06 14:50:55", "text": "Dear Amelia Test,\n\nYou have successfully scheduled amelia service appointment with New Employee. We are waiting for you at on May 2, 2023 9:00 am.\n\nThank you for choosing our company,\n", "phone": "+381631652656", "alphaSenderId": "Amelia", "status": "prepared", "price": null, "segments": null, "userFullName": "Amelia Test" } ], "countFiltered": 23 } }
Send scheduled notifications
Send scheduled notifications.
Method
This endpoint accepts GET requests.
Path
/notifications/scheduled/send
Example
Send undelivered notifications
Send undelivered notifications.
Method
This endpoint accepts GET requests.
Path
/notifications/undelivered/send
Example
Send test e-mail
Send test e-mail.
Method
This endpoint accepts GET requests.
Path
/notifications/email/test
Required Properties
The following properties are required.
Key | Type | Description |
---|---|---|
recipientEmail
|
string | The e-mail which to send to |
notificationTemplate
|
integer | The notification id. |
type | string | The type of the notification. Possible values: “appointment”, “event”, “package” |
Optional Properties
The following properties are optional.
Key | Type | Description |
---|---|---|
language
|
string | The language in which to send the notification |
Example
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications/email/test' \ --header 'Content-Type: application/json' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \ --data-raw '{ "recipientEmail": "[email protected]", "notificationTemplate": 1, "language": null, "type": "appointment" }'
{ "message": "Test email successfully sent", "data": null }
Delete notification
Delete notification.
Method
This endpoint accepts POST requests.
Path
/notifications/delete/{{notification_id}}
Example
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications/delete/123' \ --header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{ "message": "Successfully deleted notification.", "data": { "notification": { "id": 123, "name": "customer_appointment_approved", "customName": "Custom notification new name", "status": "enabled", "type": "email", "entity": "appointment", "time": null, "timeBefore": null, "timeAfter": null, "sendTo": "customer", "subject": "%service_name% Notification Subject", "content": "<p>Dear <strong>%customer_full_name%</strong>, </p><p><br></p><p>Notification Content</p><p><br></p><p>Thank you for choosing our company, </p><p><strong>%company_name%</strong></p>", "translations": null, "entityIds": [ 1, 2 ], "sendOnlyMe": null, "whatsAppTemplate": null, "minimumTimeBeforeBooking": null }, "update": false, "id": "123" } }