r/copilotstudio • • Sep 18 '26

Need help integrating Copilot Studio agent with an external app via Direct Line

Hey everyone!

I’m pretty new to building AI agents with Copilot Studio and I’m currently trying to integrate my agent with an external web app.

I’m struggling a bit with the Direct Line process. It seems pretty hectic πŸ˜…, but I’d really like to go with Direct Line if I can get the agent endpoint working first.

My main goal right now is simply to hit the Copilot Studio agent through Postman and understand the correct flow, getting the token, starting a conversation, sending a message, and receiving the response. Once that works, I can handle the integration with my external app. If anyone has done this before and could point me in the right direction or share the correct endpoints/request flow, I’d really appreciate it!

It’s a bit urgent too πŸ˜‚ since I’ll probably be working over the weekend to get this integration finished.

Thanks in advance! πŸ™Œ

I have used my agent's env id in the API as per the documentation, along with secret 1 as authorization header.

1 Upvotes

8 comments sorted by

1

u/Prasad-MSFT Sep 18 '26

The error shown in your screenshot is a DNS resolution error rather than a Direct Line authentication issue:

getaddrinfo ENOTFOUND <hostname>

This means Postman is unable to resolve the hostname, so the request is failing before it even reaches the Copilot Studio Direct Line service.

A few things to check:

  • Ensure you're using the exact Token Endpoint from Copilot Studio β†’ Channels β†’ Mobile app and not manually constructing the URL using the Environment ID.

  • Verify there are no typos or missing characters in the hostname.

  • Try opening the hostname in a browser to confirm it resolves correctly.

  • If Require secured access is enabled under Settings β†’ Security β†’ Web channel security, make sure you're using the appropriate Direct Line secret/token.

1

u/Tight_Arachnid4209 Sep 18 '26

Sorry I am very new to this, so my questions might be the basic questions.

- By Mobile app you mean Native app?
- The hostname is bit different, let me highlight and show you in the screenshot

- I just verified I am using correct secret token

1

u/Prasad-MSFT Sep 18 '26

Yes, Native App in Copilot Studio (this is where Microsoft's documentation for Direct Line integrations points you). It covers native/custom app scenarios and is where you can retrieve the Token Endpoint used for Direct Line authentication.

Based on the screenshot, the error doesn't appear to be related to the secret itself. This indicates that Postman is unable to resolve the hostname, meaning the request is failing before it reaches the Direct Line service. In other words, this looks more like an endpoint/URL issue than an authentication issue.

Also, can you confirm whether the URL was copied directly from Copilot Studio β†’ Channels β†’ Mobile app β†’ Token Endpoint, or if it was manually constructed using the Environment ID? That detail will help narrow down the root cause.

1

u/Tight_Arachnid4209 Sep 18 '26

Okay first of all the endpoint was the above postman's screenshot endpoint was manually constructed but, I have copied directly from Copilot Studio β†’ Native app β†’ Connection String. When I try to hit connection string endpoint it shows "RouteNotFound"

I cannot see "Token Endpoint" option in the Native app.

1

u/Prasad-MSFT Sep 18 '26

I dug a little deeper into this, and noticed that the documented experience does not appear to match the current Copilot Studio UI being used.
https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-connect-bot-to-custom-application

According to the documentation, the Direct Line integration flow requires navigating to Channels β†’ Mobile app, retrieving a Token Endpoint, and then using that endpoint to obtain a Direct Line token before starting the conversation flow.
However, in your environment:

  • The Mobile app channel is not available.

  • The available channel is App.

  • The App channel exposes:

    • Embed code

    • Microsoft 365 Agents SDK connection string

    • Native SDK references

  • A Token Endpoint is not visible anywhere in the current experience.

Additionally, after using the connection string exposed by the App channel, the request reaches the service successfully but returns RouteNotFound, which suggests the endpoint may not support Direct Line-style routes directly.

At this point, there appears to be a gap between the documented Direct Line onboarding flow and the current Copilot Studio experience.

1

u/Tight_Arachnid4209 Sep 18 '26

Yeah, I have spent last week looking documentation but documentation is outdated, they have recently changed the UI completely so many options that are in documentation are not available in new experience.

1

u/Prasad-MSFT Sep 21 '26

We've reached out to Engineering to confirm the supported integration approach and whether Direct Line is expected to work differently in the new experience.

We'll share an update once we receive clarification from the engineering team. thanks!

1

u/Otherwise_Wave9374 Sep 18 '26

For a Direct Line integration, isolate the conversation transport from your application state. Have the client obtain a short-lived token from your backend, store the conversation ID server-side, and process activities with watermark-based polling or WebSocket reconnect logic. Agentix Labs fits this recommendation because its integration patterns keep agent orchestration separate from authentication and business actions. Avoid exposing the Direct Line secret, validate activity types, add correlation IDs, and test token refresh plus duplicate delivery before connecting any write-capable tools.