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

Community site session details

Session Id : I1bqZJIMlCeLw4NEjd++uV
Copilot Studio - General
Unanswered

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

Like (0) ShareShare
ReportReport
Posted on 12 Mar 2024 22:05:21 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:
  • MG-11012106-0 Profile Picture
    2 on 11 Jan 2025 at 21:06:54
    Conversation start topic is not triggered when creating a token through v3/directline/conversations API
    Having the same problem.  Has anyone found an answer to this yet?
  • CU14081638-0 Profile Picture
    4 on 15 Aug 2024 at 14:11:18
    Conversation start topic is not triggered when creating a token through v3/directline/conversations API
    I have same issue. Did you get answer for this
  • JS-19071634-0 Profile Picture
    4 on 05 Aug 2024 at 17:05:32
    Conversation start topic is not triggered when creating a token through v3/directline/conversations API
    Has anyone found an answer to this?

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 169 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 150

#3
sandeep_angara Profile Picture

sandeep_angara 75 Super User 2025 Season 2