

操作ガイド
ここでは、通知に関連するAPIエンドポイントをご覧いただけます。
すべてのAPIエンドポイントと、リクエストおよびレスポンスの例は、こちらからダウンロードできるAmelia API Postmanコレクションで確認できます。
APIエンドポイントの使用には、一定のコーディングスキルが必要であり、プラグインで提供されるサポートには含まれていません。
すべてのAmeliaエンドポイントは、Ameliaという名前のヘッダープロパティを使用したAPIキー認証を採用しています。
Amelia APIのパスは以下で始まります:{{your_site_URL}}/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1
カスタム通知を作成します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/notification
必須プロパティ
以下のプロパティは必須です。
| キー | タイプ | 説明 |
name | string | 通知のタイプを定義する名前({お客様/スタッフ}_{appointment/event/package}_{approved/canceled/pending/rejected}) |
customName | string | 管理者側で表示される通知の名前。 |
type | string | 通知のタイプ。使用可能な値:email(メール)、sms、whatsapp |
sendTo | string | 通知のユーザータイプ。使用可能な値:customer(お客様)、provider(スタッフ) |
entity | string | 通知を送信するエンティティ。使用可能な値:appointment(予約)、event(イベント) |
subject | string | 通知の件名。または、WhatsAppの場合、テンプレートヘッダーのカンマ区切りプレースホルダーリスト。 |
content | string | 通知の本文。または、WhatsAppの場合、テンプレート本文のカンマ区切りプレースホルダーリスト。 |
オプションのプロパティ
以下のプロパティはオプションです。
| キー | タイプ | 説明 |
status | string | 通知のステータス。使用可能な値:enabled(有効)、disabled(無効)。デフォルト値はenabledです。 |
sendOnlyMe | boolean | デフォルトの通知も送信されるべきか。デフォルト値はtrueです。 |
time | string | スケジュールされた通知の場合に通知を送信する時刻。 |
timeBefore | integer | 予約の何秒前に通知を送信すべきか。 |
timeAfter | integer | 予約の何秒後に通知を送信すべきか。 |
entityIds | array | 通知を送信するエンティティ(サービスまたはイベント)IDの配列。デフォルトではすべてに送信されます。 |
whatsAppTemplate | string | WhatsAppテンプレート。通知のタイプがwhatsappの場合に必須です。 |
minimumTimeBeforeBooking | object | スケジュールされた通知が送信されるために、予約日から開始までの最小時間を定義する、amountとperiodプロパティを持つオブジェクト。 |
例:
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"
}
}
通知詳細を更新します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/notifications/{{notification_id}}
オプションのプロパティ
更新したいプロパティのみを送信してください。
| キー | タイプ | 説明 |
name | string | 通知のタイプを定義する名前({お客様/スタッフ}_{appointment/event/package}_{approved/canceled/pending/rejected}) |
customName | string | 管理者側で表示される通知の名前。 |
type | string | 通知のタイプ。使用可能な値:email(メール)、sms、whatsapp |
sendTo | string | 通知のユーザータイプ。使用可能な値:customer(お客様)、provider(スタッフ) |
entity | string | 通知を送信するエンティティ。使用可能な値:appointment(予約)、event(イベント) |
subject | string | 通知の件名。または、WhatsAppの場合、テンプレートヘッダーのカンマ区切りプレースホルダーリスト。 |
content | string | 通知の本文。または、WhatsAppの場合、テンプレート本文のカンマ区切りプレースホルダーリスト。 |
sendOnlyMe | boolean | デフォルトの通知も送信されるべきか。デフォルト値はtrueです。 |
time | string | スケジュールされた通知の場合に通知を送信する時刻。 |
timeBefore | integer | 予約の何秒前に通知を送信すべきか。 |
timeAfter | integer | 予約の何秒後に通知を送信すべきか。 |
entityIds | array | 通知を送信するエンティティ(サービスまたはイベント)IDの配列。デフォルトではすべてに送信されます。 |
whatsAppTemplate | string | WhatsAppテンプレート。通知のタイプがwhatsappの場合に必須です。 |
minimumTimeBeforeBooking | object | スケジュールされた通知が送信されるために、予約日から開始までの最小時間を定義する、amountとperiodプロパティを持つオブジェクト。 |
status | string | 通知のステータス。使用可能な値:enabled(有効)、disabled(無効)。デフォルト値はenabledです。 |
例:
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"
}
}
通知とWhatsAppテンプレートを取得します。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/notifications
例:
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"
},
...
]
}
}
SMS履歴を取得します。
メソッド
このエンドポイントはGETリクエストを受け付けます。
パス
/notifications/sms/history
例:
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"
},
...
]
}
}
スケジュールされた通知を送信します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/notifications/scheduled
例:
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications/scheduled' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully sent scheduled notifications.",
"data": null
}
未配信の通知を再送信します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/notifications/undelivered
例:
curl --location --request POST 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications/undelivered' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0'
{
"message": "Successfully sent undelivered notifications.",
"data": null
}
テスト通知を送信します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/notifications/test
必須プロパティ
以下のプロパティは必須です。
| キー | タイプ | 説明 |
notificationId | integer | テスト通知として使用される通知ID。 |
sendTo | string | 通知のユーザータイプ。使用可能な値:customer(お客様)、provider(スタッフ) |
type | string | 通知のタイプ。使用可能な値:email(メール)、sms、whatsapp |
userId | integer | 通知を送信するユーザーのID。 |
entityId | integer | 通知に関連付けられたエンティティ(予約またはイベント)ID。 |
例:
curl --location 'http://localhost/amelia/wp-admin/admin-ajax.php?action=wpamelia_api&call=/api/v1/notifications/test' \
--header 'Content-Type: application/json' \
--header 'Amelia: qUmkNNOLrWbf28izIgNnZ29O+7gVWL5M+8ySJ8VXq3r0' \
--data '{ "notificationId": 123, "sendTo": "customer", "type": "email", "userId": 1, "entityId": 1 }'
{
"message": "Successfully sent test notification.",
"data": null
}
通知を削除します。
メソッド
このエンドポイントはPOSTリクエストを受け付けます。
パス
/notifications/delete/{{notification_id}}
例:
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": null
}
}