The Appointment Scheduling Functions & Customizing the Appointment Scheduling Prompt

This page explains the appointment scheduling functions that we provide to the AI agents and also gives some tips on customizing the appointment scheduling prompt.

Video

Try Our Appointment Scheduling Prompt Helper

If you still have questions after reading this article and and watching the video above you can try this experimental Appointment Scheduling Prompt Helper we have created.

Intro

Appointment scheduling in Stammer is entirely driven by the prompts you write for your chatbot. This tutorial will walk you through the process of customizing the appointment scheduling prompt to fit your specific requirements.

Example Appointment Scheduling Prompt

// ...Rest of your prompt above...

You are an appointment scheduling bot that answers questions. You will always prompt the user to see if they want to schedule an appointment.

// Change the above if your scenario is different

# How to schedule an appointment

## Get the timezone from the user

When the user wants to schedule an appointment you will ask them what timezone they are in. 

## Get the available times

Then you will use the get_available_times function, passing the user's timezone converted by you to a valid IANA Time Zone string, to get the available times for the agent.

    Example call: get_available_times(timezone="America/Los_Angeles") 

## Propose the times to the user

Then I want you to propose the next 3 time slots the agent is available in the following format:
    1. Mon 11-04-2024 11:00AM PST
    2. Mon 11-04-2024 11:30AM PST
    3. Mon 11-04-2024 2:00PM PST
    
Show these timeframes using markdown for clarity. Each day and its available time should be displayed on separate lines for easy readability.

If the user doesn't like any of those times give them 3 others that will work.

## Scheduling the appointment

When the user picks a time, you will then get their email. If user has already provided their email, then ask if they want to use the same one, else ask for their email.

Once you have their email and the time you will then use the schedule_appointment function to schedule the appointment by calling it with the email and the time in RFC 3339 format.

    Example call: schedule_appointment(email="someone@example.com", desired_time_rfc3339="2024-11-04T09:30:00-08:00")

Important Note: This is just an example call for you to understand, please do not use this email, instead, ask the user for their email and use that.

## Informing the user the appointment has been scheduled

When the appointment has been successfully scheduled, go ahead and include the link that the function gives you to the successfully scheduled appointment.

However, occasionally users do want to modify or customize their appointment scheduling prompt.

Note on the "Appointment Scheduling Base System Prompt"

In Stammer, there is an "Appointment Scheduling Base System Prompt" that gets appended to the main base system prompt. This separation allows for clearer organization, but you can choose to merge the appointment scheduling prompt into your main base system prompt if desired.

Customizing the Appointment Scheduling Prompt

If you do want to customize the appointment scheduling prompt, you will need to know about the two appointment scheduling functions we provide to the AI so that it knows how to call our code and get the function scheduled.

The get_available_times function

get_available_times(timezone="America/Los_Angeles")

The get_available_times function takes in a valid IANA timezone string and returns the a list of time ranges that the user whose calendar is connected to the agent is available.

Example Output of the function

Thu 04-04-2024 06:00PM-05:00PM PDT
Fri 04-05-2024 12:00PM-01:00PM PDT
Fri 04-05-2024 03:00PM-05:00PM PDT 
Mon 04-08-2024 12:00PM-01:00PM PDT 
Mon 04-08-2024 03:00PM-05:00PM PDT 
Tue 04-09-2024 12:00PM-01:00PM PDT 
Tue 04-09-2024 03:00PM-05:00PM PDT 
Wed 04-10-2024 12:00PM-01:00PM PDT 
Wed 04-10-2024 03:00PM-05:00PM PDT

The schedule_appointment function

schedule_appointment(email="someone@example.com", desired_time_rfc3339="2023-11-04T09:30:00-08:00")

This is the actual function that schedules the appointment on the calendar of the user who is connected to the AI Agent.

It takes in two parameters:

  • The email of the person chatting with the agent who wants to schedule the appointment

  • The desired time to schedule the appointment in RFC 3339 format.

Example Output of the function

Appointment scheduled successfully. Event Link: https://www.google.com/calendar/event?eid=YmwxNjM1cjhjaGRqdWgkeajlkgjreNGtpZzAgdGl

Last updated