MENU

料金プラン

機能一覧

デモ

ご利用の流れ

お役立ちコラム



通知

操作ガイド

Amelia API – 通知

ここでは、通知に関連する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

必須プロパティ

以下のプロパティは必須です。

キータイプ説明
namestring通知のタイプを定義する名前({お客様/スタッフ}_{appointment/event/package}_{approved/canceled/pending/rejected}
customNamestring管理者側で表示される通知の名前。
typestring通知のタイプ。使用可能な値:emailメール)、smswhatsapp
sendTostring通知のユーザータイプ。使用可能な値:customerお客様)、providerスタッフ
entitystring通知を送信するエンティティ。使用可能な値:appointment(予約)、event(イベント)
subjectstring通知の件名。または、WhatsAppの場合、テンプレートヘッダーのカンマ区切りプレースホルダーリスト。
contentstring通知の本文。または、WhatsAppの場合、テンプレート本文のカンマ区切りプレースホルダーリスト。

オプションのプロパティ

以下のプロパティはオプションです。

キータイプ説明
statusstring通知のステータス。使用可能な値:enabled(有効)、disabled(無効)。デフォルト値はenabledです。
sendOnlyMebooleanデフォルトの通知も送信されるべきか。デフォルト値はtrueです。
timestringスケジュールされた通知の場合に通知を送信する時刻。
timeBeforeinteger予約の何秒前に通知を送信すべきか。
timeAfterinteger予約の何秒後に通知を送信すべきか。
entityIdsarray通知を送信するエンティティ(サービスまたはイベント)IDの配列。デフォルトではすべてに送信されます。
whatsAppTemplatestringWhatsAppテンプレート。通知のタイプがwhatsappの場合に必須です。
minimumTimeBeforeBookingobjectスケジュールされた通知が送信されるために、予約日から開始までの最小時間を定義する、amountperiodプロパティを持つオブジェクト。

リクエスト
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}}

オプションのプロパティ

更新したいプロパティのみを送信してください。

キータイプ説明
namestring通知のタイプを定義する名前({お客様/スタッフ}_{appointment/event/package}_{approved/canceled/pending/rejected}
customNamestring管理者側で表示される通知の名前。
typestring通知のタイプ。使用可能な値:emailメール)、smswhatsapp
sendTostring通知のユーザータイプ。使用可能な値:customerお客様)、providerスタッフ
entitystring通知を送信するエンティティ。使用可能な値:appointment(予約)、event(イベント)
subjectstring通知の件名。または、WhatsAppの場合、テンプレートヘッダーのカンマ区切りプレースホルダーリスト。
contentstring通知の本文。または、WhatsAppの場合、テンプレート本文のカンマ区切りプレースホルダーリスト。
sendOnlyMebooleanデフォルトの通知も送信されるべきか。デフォルト値はtrueです。
timestringスケジュールされた通知の場合に通知を送信する時刻。
timeBeforeinteger予約の何秒前に通知を送信すべきか。
timeAfterinteger予約の何秒後に通知を送信すべきか。
entityIdsarray通知を送信するエンティティ(サービスまたはイベント)IDの配列。デフォルトではすべてに送信されます。
whatsAppTemplatestringWhatsAppテンプレート。通知のタイプがwhatsappの場合に必須です。
minimumTimeBeforeBookingobjectスケジュールされた通知が送信されるために、予約日から開始までの最小時間を定義する、amountperiodプロパティを持つオブジェクト。
statusstring通知のステータス。使用可能な値: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履歴の取得

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

必須プロパティ

以下のプロパティは必須です。

キータイプ説明
notificationIdintegerテスト通知として使用される通知ID。
sendTostring通知のユーザータイプ。使用可能な値:customerお客様)、providerスタッフ
typestring通知のタイプ。使用可能な値:emailメール)、smswhatsapp
userIdinteger通知を送信するユーザーのID。
entityIdinteger通知に関連付けられたエンティティ(予約またはイベント)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
}
}