Attempt to send message from Postman to Bot API returning Activity of type:'trace' with value:'Error: The clientSecret parameter is required.'

Leo Messi 20 Reputation points
2023-09-14T06:57:50.01+00:00

The bot app is based on this sample by Microsoft- https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/meetings-notification/nodejs . I have attached a screenshot of what happens when you send a message to the bot from the teams meeting chat, i.e. an adaptive card getting posted in the meeting chat when we send the bot the message "sendContentBubble".

I am trying to replicate this sending of message to the bot from teams meeting chat by making a POST api call to the bot's endpoint with the message "sendContentBubble". The endpoint where I tried to send the post request is http://localhost:3978/api/messages since I am running my bot app locally in this port. My request had the bearer token added for authorization and I have attached the screenshot of the json object that was part of the post API call. The JSON payload aims to replicate the payload that gets sent to the api endpoint when the message is sent to the bot from the meeting chat.

The API call is returning me a 200 status code meaning that the API call was successful. However, the issue is when the bot is supposed to respond with an adaptive card in the meeting chat based on the API call that was made to it, no adaptive card gets returned in the meeting chat and if take a closer look at the Activity object that came back from the bot, we can see that there is an error with the description 'Error: The clientSecret parameter is required.'

I have attached the screenshot of the Activity object returned by the bot. The POST API call that I made had a valid bearer token added for which there was no Authorization error. I have attached a screenshot of the headers that were present in the API call as well below. So, where am I being expected to add the clientSecret parameter which would potentially resolve the issue? I tried adding "Client-Secret" in the header and provide the secret from the bot App registration in Azure but I still get "[onTurnError] unhandled error: Error: The clientSecret parameter is required. ".

User's image

User's image

User's image

User's image

Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,204 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Nivedipa-MSFT 3,011 Reputation points Microsoft Vendor
    2023-09-15T06:53:12.3333333+00:00

    @Leo Messi - The error message suggests that the client secret parameter is missing. The client secret is a credential used to authenticate the bot with the Azure AD. To resolve this issue, you need to provide the client secret in the appropriate location.

    In the context of the sample code provided, the client secret is typically stored in the .env file or as an environment variable. You can find the .env file in the sample code repository you mentioned (https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/meetings-notification/nodejs/.env).

    To add the client secret, follow these steps:

    1. Open the .env file in the sample code repository.
    2. Look for the MicrosoftAppId and MicrosoftAppPassword properties.
    3. Replace the value of MicrosoftAppPassword with your client secret.

    Here is an example of how the .env file should look:

    
    MicrosoftAppId=<<MICROSOFT_APP_ID>>
    MicrosoftAppPassword=<<MICROSOFT_APP_PASSWORD>>
    BaseUrl=<<BaseURL>>
    
    

    Thanks,

    Nivedipa


    If the response is helpful, please click "Accept Answer" and upvote it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.