Skip to main content

API Request and Prompt Creation

Goal

Configure a request to the IMDB API to get details for a specific movie in the chatbot.

Main Steps

Configuring the API Request

  • Created a new endpoint for movie details
  • Used KeyVault to protect sensitive data
  • Added a dynamic movie_id parameter to the request
  • Configured the URL to accept the parameter dynamically

Implementation in the Chatbot

  1. In the click event:

    • Added await ready to ensure the data is loaded
    • Selected the movie in the all_movies table
    • Retrieved the ID of the selected movie
  2. Made the request to the IMDB API

    • Used the movie API client
    • Passed the movie_id dynamically
    • Stored the result in a Step
  3. Processing the Response

    • Called the movie assistant bot
    • Built a prompt with the movie's official information
    • Converted the result to JSON
    • Generated a detailed response about the movie

Final Result

The chatbot can now:

  • Identify the movie
  • Make a request to the IMDB API
  • Retrieve official details
  • Generate a personalized response for the user