USSD-GPT (The Journey So Far)

#technology #ussd #chatgpt #ussdgpt #innovation #openapi #qrios #sms



What is USSD-GPT?

USSD-GPT is a mix of USSD technology, SMS, and artificial intelligence (AI) to bridge the gap between people who don't have the knowledge and digital devices to access artificial intelligence applications like ChatGPT, Google Bard, and others.

I will start by giving definitions of the major technologies used by this application.

What is USSD Technology?

USSD (Unstructured Supplementary Service Data) is a quick, interactive mobile technology that allows users to access services, check balances, and engage with applications using simple, real-time menus on their phones without internet connectivity. It's like a speedy text-based magic wand for on-the-go information and transactions.

What is Artificial Intelligence?

Artificial Intelligence (AI) is the magic of machines mimicking human intelligence, enabling them to learn, reason, and perform tasks, bringing a touch of brilliance to automation and problem-solving in our tech-driven world.

What is SMS?

SMS (Short Message Service) is the succinct sorcery of text messaging, delivering brief, instant exchanges of words and emojis between mobile devices, weaving a thread of communication that transcends time zones and connects us in the blink of a text.

What inspired us to build USSD-GPT?

USSD-GPT emerges from the fusion of USSD technology, SMS, and AI, with a mission to empower individuals lacking digital access to seamlessly engage with advanced AI applications such as ChatGPT.

In recent times everybody Googles or asks ChatGPT for the information they need but how do feature phone users who don't have access to the internet enjoy these modern technologies?

How does USSD-GPT work?

USSD-GPT solves the above in an innovative way.

Let us look at the use-case where a market woman using a Nokia 3310 wants to know the current weather in Ikeja, Lagos state.

She sends an SMS to the USSD-GPT phone number with the text "What is today's weather in Ikeja".

USSD-GPT leverages relevant APIs, including the OpenAI API, to process and interpret SMS received from users.

OpenAI response guides USSD-GPT to invoke a real-time weather API for the specific request.

Subsequently, OpenAI API parses the response into a concise message, which will be saved in the USSD-GPT database. A unique USSD code is generated and dispatched to the user via SMS.

The user can then dial the USSD code to access and read the response to their request.

The services integrated to achieve the above are listed below:-

1. Qrios SMS API Link Here

2. OpenAI API Link Here

3. Qrios USSD Integration. Link Here

4. Weather API. Link Here

5. Google Search API Link Here (For some other use cases we might need to get real-time information from Google Search to boost the accuracy of the final response to the user).

Features of USSD-GPT... (Now, let's delve into some technical jargon!🙂🙂🙂)

1. The code snippet below is a service that receives and process user request sent via SMS

The code snippet above fetches the previous interactions of the user with the system within the last hour.

This enables the application to maintain context within a conversation with the user. This improves the user experience of the application. Users can use phrases like "Tell me more" and the app will respond with more information about the last request based on previous requests.

2. We instructed OpenAI API to limit its response to 200 characters because we are going to be displaying it to the user via USSD.

3. Another important part of the request is the functions feature of OPENAI API which enables us to add functions to get real-time information from Google search API and weather API depending on the request of the user. You can read more about it here. The code snippet below shows how we implemented it.

The above code snippet is for the get current weather data function.

The above code snippet is for the Google search function.

These functions' descriptions will be added to the request body which will be sent to OpenAI API.

4. The code snippet below shows where we make the first API call to OpenAI API which will return a final response or instruct us to call a function and send the output of that function back to it for a final response.

5. A vital part of the decision-making based on step 4 response is the FinishReason Field in Choices Object in the response from OpenAI API. The usage of this is shown below.

Basically, If The finishReason field is function_call then we check the function name it wants us to call and make the API call for that function. We set the output to the externalApiResponse variable whose value will be sent back to OpenAPI for a final parsing of the response. See the implementation below.

6. The next step is saving the response to our database alongside a unique code called the chat code which will be generated for the user and sent back to the user via SMS.

7. Another important aspect of the application is the Integration to Qrios USSD to display the response when the user dials the USSD Code. We came up with an innovative way to display about 200 characters max to the user in 1, 2, or 3 USSD screens within a USSD session. The user can enter "1" to view the next screen to continue reading the response.

To work with Qrios USSD, You have to implement two required endpoints on your webhook to handle incoming USSD requests to your application.

a. New USSD Session

b. Continue USSD Session

You can read more about it Link Here

The code implementations to achieve these are shown below.

Enough Technical Jargon for one day 😂😂....back to the Story of our Journey so far with USSD-GPT

We tested it out and got feedback from the first User who encountered some issues and room for improvement which were all implemented to form this final beautiful application.

While working on this project I have seen firsthand what is possible when various technologies are used together to create a solution that will be of great impact to the users.

Just like preparing a soup every ingredient contributes its own bit to the final outcome.

USSD Technology beautifully bridges the gap to the end users enabling them to be able to enjoy the enormous potentials of artificial intelligence.

Try out USSD-GPT today and share your feedback in the comment section.

1. Send your request to this phone number +1 469-290-3326

2. You will get an SMS containing the USSD code to dial to read your response.

Thanks for your time. See you in the comments.