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.
También puede crear acciones personalizadas en Genesys Cloud para usar con sus integraciones de acciones de datos. Copie una acción existente (estática o personalizada) para usarla como plantilla, o siga estos pasos para crear una acción completamente nueva. Cuando agrega una acción, puede agregar contratos y configuración o importarlos desde otra acción de datos.
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.
Para crear una acción de datos en Genesys Cloud, complete estos pasos:
- En Genesys Cloud, haga clic en Administración.
- Debajo Integraciones, haga clic en Comportamiento.
- Crea una acción personalizada para integraciones
- Agregar contratos.
- Agregar configuración.
- Prueba la acción.
Para más información, ver Gestionar acciones individuales para integraciones.
Example: A test API endpoint
Example: Genesys Cloud data action Contracts tab
- Desde la página de inicio de Architect, haga clic o coloque el cursor sobre el Flujos menú y seleccione Flujos de bots digitales.
- Hacer clic Agregar. Se abre el cuadro de diálogo Crear flujo de bot.
- En el Nombre campo, ingrese un nombre único para el flujo.
- (Opcional) En el Descripción campo, agregue una oración o frase corta para describir este flujo.
- Haga clic en el Idioma predeterminado lista y seleccione el idioma admitido predeterminado del flujo.
- Haga clic en el Divisiones lista y seleccione la división en la que colocar el flujo.
- Hacer clic Crear flujo. Se abre la página de configuración del flujo.
Para llamar a una acción de datos desde un flujo de bot de Architect, siga estos pasos:
- Desde la caja de herramientas de Architect, arrastre un Llamar a la acción de datos en el editor de tareas, debajo del elemento Inicio.
- Bajo Categoría, seleccione la categoría de integraciones adecuada; por ejemplo, acciones de datos de servicios 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.
- Haga clic en Slot.
- 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.
- Publica el flujo.
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.
Ahora puede llamar a este flujo de bots digitales desde un flujo de mensajes entrantes.