-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Description
I have a teams bot SDK setup which is connected to 2 Copilot Studio agents. When i run the SDK in playground it works fine the agents are working and responding as expected
in one of my agents i am sending an Adaptive card to take a Input. I am able to display the adaptive card in Teams playground but I dont know how to submit the value [when i press submit] from the adaptive card to Copilot studio agent
this is my code in the Index.js in Teams bot SDK to handle messages
agentApp.activity(ActivityTypes.Message, async (context, state) => {
var activity = context.activity;
var userMessage = activity.text;
console.log(`Received activity: ${JSON.stringify(activity, null, 2)}`);
try {
if (userMessage !== null && userMessage !== undefined) {
console.log(`Received message: ${userMessage}`);
// FIXED: Pass context to callAgent function
var respo = await callAgent(userMessage, context);
console.log(`Response from callAgent:`+ JSON.stringify(respo, null, 2) );
} else if (activity.type === ActivityTypes.EndOfConversation) {
// Optionally handle cleanup
// delete conversations[agentKey];
} else {
console.log("Unhandled activity type:", activity.type);
}
} catch (error) {
console.error('Error processing message:', error);
await context.sendActivity("I encountered an error processing your message. Please try again.");
}
});
And this is the message i am getting when i submit the adaptive card
Received activity: {
"type": "message",
"id": "",
"channelId": "msteams",
"from": {
"id": "user-id",
"name": "Alex Wilber",
"aadObjectId": "00000000-0000-0000-0000-00000000000"
},
"timestamp": "",
"localTimestamp": "",
"localTimezone": "Asia/Calcutta",
"serviceUrl": "http://localhost:55222/_connector",
"conversation": {
"conversationType": "personal",
"tenantId": "00000000-0000-0000-0000-000000000000",
"id": "personal-chat-id"
},
"recipient": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "Test Bot"
},
"locale": "en-US",
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
"tenantId": "00000000-0000-0000-0000-00000000000",
"id": "personal-chat-id"
},
"recipient": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "Test Bot"
},
"locale": "en-US",
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
"id": "personal-chat-id"
},
"recipient": {
"id": "00000000-0000-0000-0000-000000000000",
"name": "Test Bot"
},
"locale": "en-US",
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
"name": "Test Bot"
},
"locale": "en-US",
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
},
"locale": "en-US",
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
"entities": [
{
"type": "clientInfo",
"locale": "en-US",
{
"type": "clientInfo",
"locale": "en-US",
"country": "US",
"type": "clientInfo",
"locale": "en-US",
"country": "US",
"locale": "en-US",
"country": "US",
"country": "US",
"platform": "Web",
"timezone": "Asia/Calcutta"
"timezone": "Asia/Calcutta"
}
],
}
],
"channelData": {
"source": {
],
"channelData": {
"source": {
"name": "message"
"channelData": {
"source": {
"name": "message"
"source": {
"name": "message"
},
"tenant": {
"name": "message"
},
"tenant": {
"id": "00000000-0000-0000-0000-0000000000001"
},
"tenant": {
"id": "00000000-0000-0000-0000-0000000000001"
}
"tenant": {
"id": "00000000-0000-0000-0000-0000000000001"
}
"id": "00000000-0000-0000-0000-0000000000001"
}
},
"replyToId": "1753092402108",
"value": {
}
},
"replyToId": "1753092402108",
"value": {
"actionSubmitId": "Submit",
},
"replyToId": "1753092402108",
"value": {
"actionSubmitId": "Submit",
"replyToId": "1753092402108",
"value": {
"actionSubmitId": "Submit",
"userName": "hishan"
}
"actionSubmitId": "Submit",
"userName": "hishan"
}
"userName": "hishan"
}
}
}
Unhandled activity type: message
Metadata
Metadata
Assignees
Labels
No labels