Use Architect to create a digital bot to schedule an appointment
You can create a digital bot flow in Architect to schedule an appointment and use the bot flow in an inbound message flow. Create the digital bot within the flow, or create it separately and then call it from the inbound message flow.
Create a digital bot for scheduling appointments using Architect
This procedure describes how to create a bot for an inbound message flow. In this example, users choose an appointment date and time from a list of time slots that the bot provides. The calendar events are retrieved from a third-party API endpoint that helps in scheduling or booking.
また、データアクション統合で使用するためにGenesys Cloudでカスタムアクションを作成することもできます。 テンプレートとして使用する既存のアクション(静的またはカスタム)をコピーするか、または次の手順に従ってまったく新しいアクションを作成します。 アクションを追加するときには、契約と構成を追加するか、別のデータアクションからそれらをインポートすることができます。
In Genesys Cloud, use a data action to retrieve the values during the bot conversation. Define the input contract and the output contract. The Output Contract in the data action must match the return message that you configure in your route to endpoint.
Genesys Cloudでデータアクションを作成するには、次の手順を実行します。
- Genesys Cloudで、 管理.
- 下 統合クリック 行動。
- 統合用のカスタムアクションを作成する
- 契約を追加する。
- 設定を追加。
- アクションをテストする。
Example: A test API endpoint
Example: Genesys Cloud data action Contracts tab
- Architect のホームページから、 流れ メニューと選択 デジタルボットフロー.
- クリック 追加する。 [Bot フローの作成] ダイアログ ボックスが開きます。
- の中に 名 フィールドに、フローの一意の名前を入力します。
- (オプション) 説明 このフローを説明する短い文またはフレーズを追加します。
- をクリックします。 既定の言語 をクリックし、フローのサポートされている言語デフォルト選択します。
- クリック 部署 フローを配置する部門をリストして選択します。
- クリックします。 フローを作成します。. フローの設定ページが開きます。
アーキテクトボットフローからデータアクションを呼び出すには、次の手順に従います。
- アーキテクトツールボックスから、 データアクションの呼び出し Start要素の下のタスクエディタに移動します。
- 下 カテゴリー、適切な統合カテゴリを選択します。たとえば、Webサービスのデータアクション。
- Under Data Action, select the scheduler data action that you created in Genesys Cloud Admin.
- To configure the Success Outputs, do the following:
- Set up a variable in the slots.startTime field to store the start DateTime values retrieved from the Call Data Action. For example,
Flow.availableStartTimes
. - Set up a variable in the slots.duration field to store the duration value retrieved from the Call Data Action. For example,
Flow.appointmentDurations
.
- Set up a variable in the slots.startTime field to store the start DateTime values retrieved from the Call Data Action. For example,
- Define Failure Outputs and Timeout.
Example: Call Data Action
Prepare a list of timeslot objects to use in your flow by converting the data from your data action.
To read through the retrieved data, use a Loop action:
- From the Architect toolbox, drag a Loop action into the task editor, below the Call Data Action.
- Add an index data name such as
Flow.loopindex
. - Set the loop’s max count to the expression,
Count(Flow.availableStartTimes)
. You can choose any of the variables defined in the Success path of your Call Data Action.
By following this method, you are running the loop once for every item returned by the data action. Later, you can create a list of timeslot objects and store it in the Collection data type. - To create a timeslot collection,
- From the Toolbox, expand the Data category and drag an Update Data action into the Loop action.
- In the Update Data workspace, click next to Update Statements and select Collections.
- With the Collections list open, select Timeslot Collection.
- Under Variable Name 1, enter a name for the list that must store the full list of timeslots. For example,
Flow.timeslots
. - Under Value to Assign 1, add the expression,
AddItem(Flow.timeslots, MakeTimeslot(ToDateTime(Flow.availableStartTimes[Flow.loopindex]), ToDuration(Flow.appointmentDurations[Flow.loopindex])))
.
The preceding expression takes the item in the list ofFlow.availableStartTimes
that matches the current loop index and converts it into a DateTime object. It also takes the corresponding item from the list ofFlow.appointmentDurations
and converts that into a duration object. Finally, it combines the two into a new timeslot object and adds that object to the Timeslot Collection variable.
- Some channels such as Apple Messages for Business do not support time selection in seconds or milliseconds. In such cases, you can limit the time format to hours and minutes in your flow to prevent any mismatching of user input.
- Each timeslot collection can have up to 50 DateTime values.
Example: Loop action
Example: Update Data action
- Under Natural Language Understanding, click Slots.
- クリックスロット。
- Provide a meaningful name for the slot and click Save.
- Under Natural Language Understanding, click Slot Types.
- Click the newly added slot type name.
- Under Timeslots, Click Add Collection. The Timeslots window appears.
- Add the expression,
Flow.timeslots
and click Close.
Example: Timeslots in Expression mode
- From the Architect toolbox, drag an Ask for Slot action into the task editor, below the Loop action.
- Under Slot, select the timeslot that you created previously and then complete the relevant fields.
- Customize the prompt image, title, subtitle, and address as how it must be presented by the bot.
- フローを公開.
Example: Ask for slot with time picker customization
Case: Data action fails
If the third-party API encounters an error, the bot flow takes the Failure path of the Call Data Action. Customize the Failure path based on your use case. For example, you can use a Transfer to ACD action to route the interaction to an available agent.
Case: Data action times out
If the request to the third-party API times out, the bot flow takes the Timeout path of the Call Data Action. The data action may succeed on a second or third attempt. To set up multiple attempts, you can place the Call Data Action within a Loop action with a fairly low Maximum Loop Count. Ensure that you also place an Exit Loop action after the Call Data Action.
Case: Third-party API returns no timeslots
Even if all timeslots are booked, the Call Data Action takes the Success path because the request is processed successfully. The bot may encounter an error as there are no timeslot values available to power the slot. In this case, the message, Error.Expresson.EmptyCollection, is shown. To prevent this error, you can place a Decision block after the Update Data action (inside the existing Loop action). You can use the Decision block to execute the Ask for Slot action only if there are valid timeslot values available. To find if the timeslots list is empty or not, use the expression, IsNotSetOrEmpty(Flow.timeslots)
.
Case: All timeslots are in the past
Even if all timeslots are in the past, the Call Data Action takes the Success path because the request is processed successfully. However, the bot cannot present a timeslot, which is in the past. To ensure that all timeslots presented to a user are in the future, you can place another Decision block before the Update Data action (inside the Loop action).
The expression, ToDateTime(Flow.availableStartTimes[Flow.loopIndex]) > GetCurrentDateTimeUtc()
, helps you to find whether a timeslot is in the past or future date.
このデジタルボットのフローを受信メッセージのフローから呼び出すことができるようになりました。