[Learning]

From WhatsApp Message to AI Answer: Connecting an Existing Copilot Studio Agent

How we brought an existing AI agent into WhatsApp, what worked in the test, and what still needs attention before customers can rely on it.

Written by Siddharth Jain
connecting-an-existing-copilot-studio-agent

Imagine a customer opening WhatsApp to ask a company a question. A few moments later, an answer appears in the same chat. Behind that simple experience, the company’s existing Microsoft Copilot Studio agent has received the question, looked for the right information, and sent a reply. The customer does not need to learn a new website or app. 

We tested whether we could make that journey work. We connected WhatsApp to an existing agent through Azure Communication Services (ACS) and a small Python application. The first message went through and came back. Then we tested the parts that make a conversation genuinely useful: remembering a follow-up, finding information in the agent’s knowledge sources, and making sure the full answer reaches the customer. 

connecting-an-existing-copilot-studio-agent
 

Figure 1. The agent in Copilot Studio before connecting it to WhatsApp. 

Native channel or custom integration 

There is a built-in way to connect a Copilot Studio agent to WhatsApp through ACS. A team can publish its agent, connect an eligible WhatsApp Business number, and deploy the channel. Microsoft’s documentation gives the current setup requirements and limits.

For this test, we used a custom connection. Think of it as a relay between WhatsApp and the agent: one service receives the customer’s message, our Python application passes it to the agent, and the reply travels back to the same WhatsApp chat. This gave us more control over the exchange, but it also meant we had to manage the relay ourselves. Our findings describe this custom setup; the built-in WhatsApp channel works differently in some important ways. Figure 2 shows the Azure Communication Services resource used for this WhatsApp messaging connection. 

connecting-an-existing-copilot-studio-agent 

Figure 2. Azure Communication Services resource used for the WhatsApp messaging connection. 

Architecture and end-to-end message flow 

connecting-an-existing-copilot-studio-agent 

The diagram shows the question traveling in and the answer traveling out. ACS connects the business’s WhatsApp number to Azure. Event Grid alerts our Python application that a new message has arrived. The application asks the Copilot Studio agent for an answer and uses ACS to send that answer back. During our local test, Microsoft Dev Tunnel gave the application a public web address so Azure could reach it. 

connecting-an-existing-copilot-studio-agent 

Figure 3. The incoming-message event subscription points to a webhook. The screen shows its configuration, not proof of message delivery. 

We tested the journey in small steps. First, we sent a WhatsApp message and confirmed that our application received it. Then the application sent a simple fixed reply. Seeing that reply on the phone told us the message could travel in both directions, even before we involved the AI agent. 

Next, we checked that the application could securely connect to the published agent and get an answer. Finally, we joined the two working pieces. A customer’s WhatsApp message could now reach the agent, and the agent’s response could return to the customer’s chat. In the test, that secure connection used a Microsoft Entra app registration and a device-code sign-in. Figure 4 shows the Microsoft Entra app registration used for that secure backend connection. 

connecting-an-existing-copilot-studio-agent 

Figure 4. Microsoft Entra app registration used by the backend to securely connect to the published Copilot Studio agent. 

Figure 5 shows the local Python bridge running after Microsoft authentication, confirming that the test application was ready to receive requests. 

connecting-an-existing-copilot-studio-agent 

Figure 5. Local Python bridge running successfully after Microsoft device-code authentication during testing. 

connecting-an-existing-copilot-studio-agent 

Figure 6. Microsoft device-code sign-in used by the backend during local testing. This is not a sign-in screen for the person messaging on WhatsApp. 

Testing in this order helped us diagnose problems. When a later question failed, we knew the WhatsApp connection itself was working and could focus on how the agent accessed information. 

Conversation context across WhatsApp messages 

A useful chat needs to remember what was said earlier. If a customer asks about two options and then types, “What about the second one?”, the agent needs to know which options they mean. 

We gave each WhatsApp sender a separate conversation ID—like a bookmark for that person’s chat. When the person asked a follow-up, we reused the bookmark so the agent could continue the same conversation. Another person received a different bookmark, keeping their questions separate. 

For the demonstration, our application kept those bookmarks in its short-term memory. If the application restarted, they would disappear. A customer-facing service would save them in a database, decide when an old conversation should expire, and handle messages that arrive close together. It should also recognize that a WhatsApp user may be identified by a business-scoped ID rather than a visible phone number. 

The bookmark helps the agent remember the conversation. It does not prove who the customer is or give them permission to see private information. 

Authentication and knowledge access 

At first, the agent answered simple questions. But when a question required information from its connected knowledge sources, the response failed with an authentication error (`AuthenticationNotConfigured`). In plain language, the application could reach the agent, but the agent was not yet set up to retrieve that information in this test. 

We first suspected Dataverse, one of the places the agent could look for information. Questions based on uploaded documents failed too. Since more than one source was affected, we checked the agent’s authentication settings rather than treating either knowledge source as the sole cause. 

In our custom setup, changing the agent from No authentication to Authenticate with Microsoft and republishing it allowed the tested knowledge questions to work. This is a result from our test, not a general instruction for the built-in WhatsApp channel. Microsoft says its native WhatsApp channel does not support Authenticate with Microsoft; it documents No authentication and Authenticate manually for that channel. 

There is an important customer-trust point here. A person sending a WhatsApp message is not automatically signed in to the company’s Microsoft systems. If the agent is allowed to use internal information, the business must decide what any WhatsApp visitor may see and what requires a verified identity. For personal or restricted answers, the system needs an appropriate sign-in and permission check. 

Streaming responses and citation processing 

Once the agent could reach its knowledge, we encountered a different issue. It started producing an answer, but the software handling the response stopped with this error: 

ClientCitation object has no field "at_id" 

The error concerned citation details—the information that points to where an answer came from. Some answer text had already arrived before the error appeared. For the local demonstration, we used the text received so far and left out the citation details that caused the problem. 

That was enough to keep testing, but it is not how we would serve a customer. The text might have stopped halfway through a sentence or missed an important qualification. Before launch, we need to fix the citation-handling issue and confirm that an answer is complete before WhatsApp displays it. If the answer cannot be completed, the customer should receive a clear failure message instead of a partial answer presented as final. 

connecting-an-existing-copilot-studio-agent 

Figure 7. A test exchange in WhatsApp. The visible citation markers illustrate the response-formatting issue discussed above; this is not a finished production response. 

Production considerations 

The test proved that an existing Copilot Studio agent can receive a question from WhatsApp and send a reply through our custom connection. It also showed that the agent could answer tested knowledge questions after the authentication change and keep different customers’ follow-up conversations separate. 

A reliable service needs more than a successful demonstration. The application needs a permanent home online, saved conversation bookmarks, secure credentials, monitoring, and a way to connect to the agent without someone manually signing in each time. It must also handle repeated delivery of the same message without sending duplicate replies; Event Grid can retry an event. Most importantly, the citation issue must be fixed so customers receive complete answers. 

WhatsApp also has rules about when a business may message someone. After a customer writes in, ordinary replies are allowed during an active 24-hour window. Once that window closes, a business generally needs an approved message template to start the conversation again. That matters for future reminders and follow-ups. [9] The team should also review what content can be sent and how customer data is handled. Microsoft notes that the built-in WhatsApp channel shares some agent and chat content with WhatsApp. 

What the integration proved 

For customers, the potential experience is straightforward: ask a common question in WhatsApp and get help without visiting another site. For the business, the agent’s information and conversation logic can continue to be maintained in Copilot Studio. The approach could support questions about products, policies, or services. Personalized account information and actions such as bookings would need additional identity checks and connections to the relevant business systems. 

The test gave us a clearer definition of success. A message arriving on a phone show that the connection works. A dependable customer experience also needs the right chat history, access to the right information, and an answer that is complete. Those are the pieces to finish before turning the communication channel into a service people can trust. 

How Inferifi can help 

Inferifi helps organizations put AI agents to work across the Microsoft stack. Our team builds and supports Copilot agents, connects them to business data through Power Platform and Azure, and delivers custom AI and machine learning solutions. Once a solution is live, our Managed Services team keeps it monitored, secure, and improving. 

Want to bring your own agent into WhatsApp? Talk to the Inferifi team about a pilot.

Loading related blogs...

Essential industry update.

Straight to your inbox.

We use analytics cookies to understand site usage, improve performance, and measure key interactions. You can accept or decline analytics tracking at any time.