How to build a Conversational AI APP in Faith Tech


As technology continues to advance, more faith communities are embracing Conversational AI to deepen connections, enrich worship services, and enhance overall community cohesion. Recent statistics reveal that in 2023, around 37% of churches occasionally utilized AI tools. By 2024, this figure is projected to surpass 66%, indicating a rapid growth in the fusion of technology and faith.
How Conversational AI Elevates the Faith Experience
Conversational AI excels at interpreting sacred texts, guiding prayers, and delivering culturally diverse and uplifting messages—all of which provide emotional and spiritual support. This leads to a more meaningful faith journey that caters to individual needs and preferences. Below are several practical examples showcasing the potential of voice-based Conversational AI in the faith-tech space.
1. AI Astrologer: Convenient Astrology Consultations
A multilingual “virtual astrologer” can analyze planetary positions in real time, offering personalized horoscopes and insights. When users pose questions, the system can instantly provide astrological predictions, responding in multiple languages through voice interaction. This immediate and adaptable approach not only reduces communication barriers but also makes astrology guidance more accessible to a wider audience.
2. Virtual Mentor: Round-the-Clock Spiritual Guidance
A Conversational AI-powered virtual mentor can offer scriptural references and spiritual counsel on demand. Using Natural Language Processing (NLP) and voice support in multiple languages, users simply ask questions, and the mentor suggests relevant passages or context-based interpretations. This online model helps individuals maintain spiritual discipline in their busy schedules and provides readily available support without geographic limitations.
3. Intelligent Guardian: Accessible Wisdom at Home
An intelligent guardian is a specialized hardware device integrated with Conversational AI that delivers daily readings, answers faith-related questions, and provides spiritual encouragement. Through cloud-based learning and real-time translation, it automatically adjusts to personal preferences, offering an experience closely aligned with each user’s needs. For those seeking regular religious practice or a moment of reflection, this blend of technology and tradition can serve as a helpful resource.
4. AI Avatars for Faith-Based Shopping: Adding Cultural Context to Purchases
An AI avatar can recommend faith-oriented items—such as sacred books, prayer beads, or other devotional products—while sharing relevant spiritual insights. By supporting voice interactions in multiple languages, the avatar educates a global community of believers on each product’s cultural or religious significance. When integrated with live-streaming events or online gatherings, these avatars further encourage interaction between religious leaders, fellow believers, and online shoppers.
Building a Web-Based Real-Time Conversation App with the Tencent RTC SDK
Below is an overview of how you can implement a no-UI, real-time chat application in a web environment using the Tencent RTC SDK. This approach focuses on maximizing audio quality while minimizing interface complexities, helping you create a streamlined solution for voice-based AI interactions.
Prerequisites
I. Integrating the RTC Engine SDK
Step 1: Import the RTC Engine SDK Into the Project and Enter the Room
Integration Guide for Web & H5 Without UI
Step 2: Releasing the Audio Stream
Use the trtc.startLocalAudio() method to enable the microphone and release the audio stream to the room.
await trtc.startLocalAudio();
II. Initiating an AI Conversation
Starting an AI Conversation: StartAIConversation
Call the StartAIConversation API in the backend to add the chatbot to the room and initiate an AI conversation.
Descriptions of currently supported STTConfig
LLMConfig
and TTSConfig
configurations:
Large Language Model Configuration(LLMConfig)
Text-To-Speech Configuration(TTSConfig)
It is recommended to verify the parameters of LLMConfig
and TTSConfig
in the following ways before you call the StartAIConversation API for the first time. The detailed information is as follows:
Conversational AI Parameter Verification
III. Receiving the Data of AI Conversation Subtitles and Chatbot Status
You can use the Receive Custom Messages provided by the RTC Engine SDK to listen to callbacks in the client to receive the data such as real-time subtitles and chatbot statuses. The cmdID value is fixed at 1.
Receiving Real-Time Subtitles
Message format:
{
"type": 10000, // 10000 indicates the subtitles are real-time subtitles.
"sender": "user_a", // User ID of the sender (speaker).
"receiver": [], // List of receivers' user IDs. The message is actually broadcasted in the room.
"payload": {
"text":"", // Text recognized by speech recognition.
"translation_text":"", // Translated text.
"start_time":"00:00:01", // Start time of a sentence.
"end_time":"00:00:02", // End time of a sentence.
"roundid": "xxxxx", // Unique ID of a conversation round.
"end": true // If the value is true, the sentence is a complete one.
}
}
Receiving the Chatbot Status Data
Message format:
{
"type": 10001, // Chatbot status.
"sender": "user_a", // User ID of the sender, which is the chatbot ID in this case.
"receiver": [], // List of receivers' user IDs. The message is actually broadcasted in the room.
"payload": {
"roundid": "xxx", // Unique ID of a conversation round.
"timestamp": 123,
"state": 1, // 1: listening; 2: thinking; 3: speaking; 4: interrupted.
}
}
Example Code
trtcClient.on(Tencent RTC.EVENT.CUSTOM_MESSAGE, (event) => {
let data = new TextDecoder().decode(event.data);
let jsonData = JSON.parse(data);
console.log(`receive custom msg from ${event.userId} cmdId: ${event.cmdId} seq: ${event.seq} data: ${data}`);
if (jsonData.type == 10000 && jsonData.payload.end == false) {
// Subtitle intermediate state
} else if (jsonData.type == 10000 && jsonData.payload.end == true) {
// That is all for this sentence.
}
});
IV. Sending Custom Messages
Custom messages of RTC Engine are uniformly sent via the client, cmdID is fixed at 2.
See Sending and Receiving Messages.
You can skip the ASR(STT) process by sending custom text and communicate directly with the AI service through text.
{
"type": 20000, // Send a custom text message in the client.
"sender": "user_a", // User ID of the sender. The server will check if this user ID is valid.
"receiver": ["user_bot"], // List of receivers' user IDs. You need to enter the chatbot user ID only. The server will check if this user ID is valid.
"payload": {
"id": "uuid", // Message ID for troubleshooting. You can use the UUID.
"message": "xxx", // Message content.
"timestamp": 123 // Timestamp for troubleshooting.
}
}
You can send an interruption signal to perform interruption.
{
"type": 20001, // Send an interruption signal in the client.
"sender": "user_a", // User ID of the sender. The server will check if this user ID is valid.
"receiver": ["user_bot"], // List of receivers' user IDs. You need to enter the chatbot user ID only. The server will check if this user ID is valid.
"payload": {
"id": "uuid", // Message ID for troubleshooting. You can use the UUID.
"timestamp": 123 // Timestamp for troubleshooting.
}
}
You can send an interruption signal to perform interruption.
{
"type": 20001, // Send an interruption signal in the client.
"sender": "user_a", // User ID of the sender. The server will check if this user ID is valid.
"receiver": ["user_bot"], // List of receivers' user IDs. You need to enter the chatbot user ID only. The server will check if this user ID is valid.
"payload": {
"id": "uuid", // Message ID for troubleshooting. You can use the UUID.
"timestamp": 123 // Timestamp for troubleshooting.
}
}
Example Code
const message = {
"type": 20001,
"sender": "user_a",
"receiver": ["user_bot"],
"payload": {
"id": "uuid",
"timestamp": 123
}
};
trtc.sendCustomMessage({
cmdId: 2,
data: new TextEncoder().encode(JSON.stringify(message)).buffer
});
V. Stopping the AI Conversation and Exiting the RTC Engine Room
- Stop the AI conversation task in the server.
Call the StopAIConversation API through the backend and terminate this conversation.
- Exit the RTC Engine room in the client. For details, see:
Integration Guide for Web & H5 Without UI
Conclusion
Conversational AI is opening up new possibilities for faith-based communities, making spiritual practices more inclusive, personalized, and engaging. As more congregations adopt these innovative solutions, the future of religious and spiritual life will likely witness even greater breakthroughs in cultural diversity, one-on-one personalization, and interactive experiences.
To learn more about integrating Tencent RTC’s voice AI features into your application or hardware, explore our Conversational AI Engine.
My name is Susie. I am a writer and Media Service Product Manager. I work with startups across the globe to build real-time communication solutions using SDK and APIs.
If you want to discover the new opportunities conversational AI can bring to faith and technology, welcome to contact us.
Subscribe to my newsletter
Read articles from shuoxin wang directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
