web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Conversation start top...
Copilot Studio
Unanswered

Conversation start topic is not triggered when creating a token through v3/directline/conversations API

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am writing a React native web app that connects to a bot in Copilot studio.

 

To render the chat I am using the `ReactWebChat` component with a directLine object, this object has its token set like this:

 

 

 

 const initializeDirectLine = async () => {
 try {
 const storedToken = localStorage.getItem('directLineToken');
 if (storedToken) {
 return createDirectLine({ token: storedToken });
 } else {
 const response = await fetch('https://unitedstates.directline.botframework.com/v3/directline/conversations', {
 method: 'POST',
 headers: {
 Authorization: `Bearer SECRET`
 }
 });

 if (response.ok) {
 const data = await response.json();
 localStorage.setItem('directLineToken', data.token);
 return createDirectLine({ token: data.token });
 } else {
 console.error('Failed to start conversation:', response.statusText);
 return {};
 }
 }
 } catch (error) {
 console.error('Error initializing Direct Line:', error);
 return {};
 }
 };

 

 

 

 

I am able to establish a connection with my bot and the conversations API call is successful, however the Conversation Start topic is not triggered (it is triggered for instance in the Test pane in Copilot Studio and also in the Demo Website, same if I were to just copy the iFrame HTML). 

 

Anything I might be doing wrong with the above code? I also tried just copying a token from the conversations API call from the Demo website and the Conversation Start is triggered but not if I generate the token directly from a fetch call.

Categories:
I have the same question (0)
  • JS-19071634-0 Profile Picture
    4 on at
    Has anyone found an answer to this?
  • CU14081638-0 Profile Picture
    6 on at
    I have same issue. Did you get answer for this
  • MG-11012106-0 Profile Picture
    2 on at
    Having the same problem.  Has anyone found an answer to this yet?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 619

#2
chiaraalina Profile Picture

chiaraalina 163 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 147

Last 30 days Overall leaderboard