in source/services/lex-bot/book_appointment/intent.py [0:0]
def create_appointment_intent(bot_id, locale_id):
logger = get_logger(__name__)
bot_language = os.environ.get("botLanguage")
# create custom slot type (AppointmentType)
slot_type_response = create_appointment_slot_type(bot_language, bot_id, locale_id)
logger.info(slot_type_response)
# extract slot_type_id
appointment_slot_type_id = slot_type_response["slotTypeId"]
# create intent
intent_response = create_intent(bot_id, locale_id)
logger.info(intent_response)
# extract intent_id
intent_id = intent_response["intentId"]
# create slots time, date and appointment type
time_slot_repsonse = create_appointment_slot(
"Time", "AMAZON.Time", "time", bot_language, bot_id, locale_id, intent_id
)
date_slot_response = create_appointment_slot(
"Date", "AMAZON.Date", "date", bot_language, bot_id, locale_id, intent_id
)
appointment_slot_response = create_appointment_slot(
"AppointmentType",
appointment_slot_type_id,
"appointmentType",
bot_language,
bot_id,
locale_id,
intent_id,
)
# extract slot id's
time_slot_id = time_slot_repsonse["slotId"]
date_slot_id = date_slot_response["slotId"]
appointment_slot_id = appointment_slot_response["slotId"]
# update the intent for prioritizing slots in the intent
update_appointment_intent(
bot_language,
intent_id,
appointment_slot_id,
date_slot_id,
time_slot_id,
bot_id,
locale_id,
)