How to use a local AI model to answer Whatsapp messages

In this article, we will guide you through the process of setting up a local AI model to automatically respond to WhatsApp messages using the Ozeki SMS Gateway. By integrating a local AI model, you can enhance your messaging system with AI-powered chatbots capable of providing intelligent, instant replies without relying on cloud-based solutions. Let’s dive into the step-by-step process!

What is WhatsApp?

WhatsApp is a popular instant messaging platform owned by Meta. It allows users to send text messages, voice messages, photos, videos, and files, as well as make voice and video calls over the internet. Available on smartphones, desktops, and web browsers, WhatsApp is widely used for personal and business communication worldwide due to its end-to-end encryption, reliability, and user-friendly interface.

What is a Local AI Model?

A local AI model is an artificial intelligence model that is installed, stored, and executed directly on a local machine or server, rather than relying on cloud-based systems. It allows users to run AI applications offline, providing full control over data privacy, security, and customization.

What is Ozeki AI Server?

Ozeki AI Server is a powerful software platform that integrates artificial intelligence (AI) with communication systems, enabling businesses to develop and deploy AI-driven applications. It supports various automation tasks like text messaging, voice calls, chatbots, and machine learning processes. By combining AI with communication networks, it enhances customer service, streamlines workflows, and improves user interactions across different industries. Ozeki AI Server provides a comprehensive solution for organizations looking to boost communication efficiency using AI technology.

What is Ozeki SMS Gateway?

Ozeki SMS Gateway is a versatile software solution designed to enable businesses to send and receive SMS messages via multiple communication channels. It integrates seamlessly with applications, databases, and APIs, offering features like automated messaging, two-way communication, and bulk SMS sending. Commonly used for notifications, alerts, marketing, and customer support, it provides a reliable tool for enhancing communication through SMS technology.

Downloading a GGUF model from Huggingface (Quick Steps)

  1. Open Huggingface Website
  2. Select GGUF Models
  3. Select Model Library
  4. Download Model File
  5. Save Model File

How to configure local AI chatbot in Ozeki SMS Gateway (Quick Steps)

  1. Open Ozeki AI Server
  2. Create New GGUF AI Model
  3. Select Model File
  4. Open SMS Gateway
  5. Add New Application
  6. Install AI Chatbot
  7. Select AI Model
  8. Enable Chatbot

How to configure Whatsapp account connection for AI messaging (Quick Steps)

  1. Open SMS Gateway
  2. Add New Connection
  3. Install WhatsApp Account
  4. Configure WhatsApp Credentials
  5. Set Default Template
  6. Set Telephone Number
  7. Enable WhatsApp Connection
  8. Create New Routes

Send Whatsapp test message what is answered by AI chatbot (Quick Steps)

  1. Open AI Chatbot
  2. Configure System Prompt
  3. Send WhatsApp Message
  4. Receive AI Response

Downloading a GGUF model from Huggingface (Video tutorial)

The video below walks you through all the steps in motion, starting with navigating to the website, all the way to moving the LLM file to the right folder. It's a worthwhile use of your time, since it takes a mere 75 seconds to watch, but captures every important step in detail.

Step 1 - Open huggingface.co page

In your browser, enter huggingface.co in the searchbar. You should land on a page similar to (Figure 1).

Open huggingface.co page
Figure 1 - Open huggingface.co page

Step 2 - Select GGUF models

First, click Models near the top edge of the screen. In the left panel, set the filter to Libraries, then select GGUF from the available options, as seen in (Figure 2).

Select GGUF models
Figure 2 - Select GGUF models

Step 3 - Select model library

Select your preferred LLM model, for the sake of this tutorial, we'll be using the following model: Meta-Llama-3.1-8B-Instruct-hf-Q4_K_M-GGUF (Figure 3).

Select model library
Figure 3 - Select model library

Step 4 - Download model file

On the page of the model, open the "Files and versions" tab, and look for the file with a .gguf format, highlighted in red in (Figure 4).

Download model file
Figure 4 - Download model file

Step 5 - Copy GGUF model file to C:\AIModels

Download the .gguf file, and move or paste it to the following folder: C:\AIModels (Figure 5).

Figure 5 - Copy GGUF model file to C:\AIModels

How to configure local AI chatbot in Ozeki SMS Gateway (Video tutorial)

In this video tutorial, you will discover how to set up a local AI chatbot in the Ozeki SMS Gateway using the GGUF model you previously downloaded. This detailed, step-by-step guide will walk you through the process of integrating the AI model with Ozeki AI Server, enabling your chatbot to efficiently respond to incoming SMS messages automatically.

Step 6 - Open Ozeki AI Server

Launch the Ozeki 10 app. If you don't already have it, you can download it here. Once opened, open the Ozeki AI Server (Figure 6).

Open Ozeki AI Server
Figure 6 - Open Ozeki AI Server

Step 7 - Create new GGUF AI model

The Ozeki AI Server interface is now visible on the screen. To create a new GGUF model, start by clicking on "AI Models" at the top of the screen. Next, click the blue button labeled "Create a new AI Model". On the right side of the interface, you will see various options, select the "GGUF" menu (Figure 7).

Create newm GGUF AI model
Figure 7 - Create new GGUF AI model

Step 8 - Select model file

After selecting the "GGUF" menu, select the "General" tab, select the "C:\AIModels\meta-llama-3.1-8b-instruct-hf-q4_k_m.gguf" Model file then click "Ok" (Figure 8).

Select model file
Figure 8 - Select model file

Step 9 - Open SMS Gateway

Launch Ozeki SMS Gateway in Ozeki 10 (Figure 9).

Open SMS Gateway
Figure 9 - Open SMS Gateway

Step 10 - Add newm user/application

After launching Ozeki SMS Gateway, navigate to the right panel under "Users and Applications" and click on "Add new user/application..." to create a new application (Figure 10).

Add newm user/application
Figure 10 - Add newm user/application

Step 11 - Install AI chatbot

From the available options, go to the "Chat bots" section and select "AI Chat Bot", then click on "Install" (Figure 11).

Install AI chatbot
Figure 11 - Install AI chatbot

Step 12 - Select AI model

In the "General" tab, deselect "Send welcome message" and choose the appropriate model, which in this case is "GGUF_Model_1". Finally, click "Ok" (Figure 12).

Select AI model
Figure 12 - Select AI model

Step 13 - Enable chatbot

To establish the connection, flip the switch to green on the left side (Figure 13).

Enable chatbot
Figure 13 - Enable chatbot

How to configure Whatsapp account connection for AI messaging (Video tutorial)

In this video, you will learn how to set up a WhatsApp account connection for AI messaging with the Ozeki SMS Gateway. This comprehensive, step-by-step tutorial will guide you through the process of configuring a WhatsApp message connection, enabling you to effortlessly receive and respond to messages using powerful AI technology.

Detailed Whatsapp configuration:
How to setup a WhatsApp message connection
Receive WhatsApp messages in SMS Gateway

Step 14 - Open SMS Gateway

Launch Ozeki SMS Gateway in Ozeki 10 (Figure 14).

Open SMS Gateway
Figure 14 - Open SMS Gateway

Step 15 - Add new connection

To create a new connection, click on "Add new connection..." on the left, in the "Management" tab (Figure 15).

Add new connection
Figure 15 - Add new connection

Step 16 - Install Whatsapp account

Under "Chat connections", select "WhatsApp account" and click on "Install" to install the service (Figure 16).

 Install Whatsapp account
Figure 16 - Install Whatsapp account

Step 17 - Configure Whatsapp credentials

Configure WhatsApp connection, under "Credentials", set "WABA-ID" and "Access token", then scroll down for more settings (Figure 17).

Configure Whatsapp credentials
Figure 17 - Configure Whatsapp credentials

Step 18 - Configure defalt template

The "Default template" is responsible for defining the standard message structure and formatting used when responding to incoming WhatsApp messages. By setting Tag 1 to Tag 4, you specify predefined message elements (Figure 18).

Configure defalt template
Figure 18 - Configure defalt template

Step 19 - Set telephone number

Then scroll down again to the bottom of the page, set the "Telephone number" and click "Ok" (Figure 19).

Set telephone number
Figure 19 - Set telephone number

Step 20 - Whatsapp account connected

After setting up Ceredentials, Default template, Phone number, make sure that "Connection" is enabled (Figure 20).

Whatsapp account connected
Figure 20 - Whatsapp account connected

Step 21 - Create new incoming route

To create a new incoming route, click on the "Routes" button at the top of the screen, then "Create new Route" and set the sender and receiver routes on the right (Figure 21).

Create new incoming route
Figure 21 - Create new incoming route

Step 22 - Create new outgoing route

To create a new outgoing route, let's create a new route again, only this time swap the sender and the receiver (Figure 18).

Create new outgoing route
Figure 22 - Create new outgoing route

Send Whatsapp test message what is answered by AI chatbot (Video tutorial)

In this video, we will show you how to test your AI chatbot’s connection and response functionality in the Ozeki SMS Gateway by sending a WhatsApp message and confirming the AI-generated response. This demonstration will help you verify that your setup is properly configured and effectively handling incoming messages.

Step 23 - Open AI chatbot

To set up the chatbot, select AI_Bot_1 on the right and click on it (Figure 23).

Open AI chatbot
Figure 23 - Open AI chatbot

Step 24 - Configure system prompt

To configure the chatbot, navigate to the "Configure" tab and select the "AI" section. In the "System Prompt" field, enter the desired prompt that will guide the chatbot's responses and check the "Use system prompt" (Figure 24).

Configure system prompt
Figure 24 - Configure system prompt

Step 25 - Send Whatsapp message

If you have completed all the previous steps successfully, it's time to put your setup to the test. To do this, send a message or ask a question via WhatsApp to the phone number configured in the Ozeki SMS Gateway. Once the message is sent, you can check the system logs to verify that your message has been properly received and recorded (Figure 25).

Send Whatsapp message
Figure 25 - Send Whatsapp message

Step 26 - Generated response received

Once you have sent your message, you will receive a response from the AI chatbot, which you can view directly on your WhatsApp account. Additionally, you can monitor and track the chatbot's reply in the system logs to confirm that the communication process is working correctly (Figure 26).

Generated response received
Figure 26 - Generated response received

More information