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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Getting issue with cal...
Copilot Studio
Unanswered

Getting issue with calling API for directlinetoken

(0) ShareShare
ReportReport
Posted on by 6

API : https://powerva.microsoft.com/api/botmanagement/v1/directline/directlinetoken?botId=525a5cab-abac-4294-ba69-888b02&tenantId=b0b120fd-1701-4d59-9e7d-9cd

 

Response : 

{
 "ErrorCode": 4103,
 "ErrorMessage": "ItemWithIdNotFound",
 "DiagnosticsMessage": null,
 "ErrorInfo": null
}

 

Categories:
I have the same question (0)
  • mboninco Profile Picture
    on at

    Hi @Vicky001 

    In the link you posted, it appears that the TenantId is truncated. When I replace the TenantId with what I believe to be the full TenantId and with a BotId I see associated with the Tenant in the logs, the API call returns.

     

    -- Mike Bonincontri

  • Vicky001 Profile Picture
    6 on at

    I tried with full tenantId and BotId, But for security purposes, I am removing some characters from the ID. 

  • GnanavelBala Profile Picture
    10 on at

    Hi, I am also facing same issue. Is any one help me about this?

  • GnanavelBala Profile Picture
    10 on at

    Hi Sir, I tried pass right TenantId & BotId. But I am facing same issue.

     

    const styleOptions = {
    // Add styleOptions to customize web chat canvas
    hideUploadButton: false
    };

    // Add your BOT ID below
    var BOT_ID = "MyBOTID";
    var Tenant_ID = "MyTenantID "

    var theURL = "https://powerva.microsoft.com/api/botmanagement/v1/directline/directlinetoken?botId=" + BOT_ID + "&tenantId=" + Tenant_ID;


    fetch(theURL)
    .then(response => response.json())
    .then(conversationInfo => {
    window.WebChat.renderWebChat(
    {
    directLine: window.WebChat.createDirectLine({
    token: conversationInfo.token,
    }),
    styleOptions
    },
    document.getElementById('webchat')
    );
    })
    .catch(err => console.error("An error occurred: " + err));

     

    Error:

    {
     "ErrorCode": 4103,
     "ErrorMessage": "ItemWithIdNotFound",
     "DiagnosticsMessage": null,
     "ErrorInfo": null
    }
  • GnanavelBala Profile Picture
    10 on at

    Hi, needs to have query string parameters to assign values to some bot variables. Is it possible?. If anybody have idea, please help me and guide me. Thanks.

  • nikviz Profile Picture
    242 on at

    Hi @GnanavelBala 

     


    nikviz_1-1683189564852.png

     

    For me the Bot id is the one highlighted in green.

    nikviz_0-1683190312178.png

     

    And in the code you need to type the bot id in this below format.

    xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
     
    If I dont use this format, i get the same error as you.
  • HenryJammes Profile Picture
    on at

    Quick question, why don't you use the token endpoint URL available in PVA to generate the token?

    I.e. this one:

    HenryJammes_0-1683190830404.png

     

  • GnanavelBala Profile Picture
    10 on at

    Yes. I used token endpoint and able to connect. Now I am trying to pass query parameter to bot variable. Is any one tried this?

  • GnanavelBala Profile Picture
    10 on at

    Hi Friends, I needs to have query string parameters to assign values to some bot variables. Is it possible?. If anybody have idea, please help me and guide me. Thanks.

  • Vicky001 Profile Picture
    6 on at

    Once I load my chabot using token endpoint URL, the start conversation topic is not working. 

    Vicky001_0-1683258999944.png

    And this one my bot topic. 

    Vicky001_1-1683259092899.png

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Copilot Studio

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 255 Super User 2025 Season 2

#2
Romain The Low-Code Bearded Bear Profile Picture

Romain The Low-Code... 205 Super User 2025 Season 2

#3
S-Venkadesh Profile Picture

S-Venkadesh 101 Moderator

Last 30 days Overall leaderboard