Create a Chatbot with your local Database using ngrok

Learn how to create a connection between your local database and DataLang to create a chatbot assistant.

  • Alexandro Martinez
    Author
    by Alexandro Martinez
    a month ago
  • Step 1: Install ngrok

    Go to ngrok's official website, and install it in your computer.

    Step 2: Run ngrok

    Assuming you have your local database running in port 5432, type in your terminal:

    ngrok tcp 5432

    You should get a Forwarding URL exposing your database.

    ngrok-expose-localdatabase.png

    In this case, the connection detaills are:

    • Host: 8.tcp.ngrok.io

    • Port: 19418

    Step 3: Create a Data Source

    Go to your datalang.io dashboard, and create a new Data Source of type PostgreSQL.

    datalang-create-postgres-datasource.png

    Step 4: Create a Data View (SQL script)

    Say you want to create a Sales Assistant, you'd write SQL similar to this:

    datalang-new-view-sql-script.png

    Run it and see if you get any results. If you don't get any rows, check your connection details (or your local data).

    Step 5: Create the Chatbot Assistant

    Select your recently created assistant and give it some instructions.

    datalang-create-chatbot-assistant.png

    Step 6: Chat wit your database

    Finally, ask the chatbot some questions about your data.

    datalang-chat-with-the-assistant.png

    Need help?

    Contact us at hello@datalang.io.

    Related Articles

    We respect your privacy.

    TLDR: We use cookies for language selection, theme, and analytics. Learn more.