microsoft / botbuilder-dotnet

Welcome to the Bot Framework SDK for .NET repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using .NET.
https://github.com/Microsoft/botframework
MIT License
864 stars 480 forks source link

The Bot Framework SDK for C# does not return a value in the Activity.LocalTimezone property when using Copilot in Microsoft Teams #6770

Closed rfessia closed 2 months ago

rfessia commented 2 months ago

Language

C#

Version

12

Description

In Microsoft Teams, when we use copilot the Activity.LocalTimezone property (in Bot Framework SDK) has no value, while if we perform a query without using copilot, it returns a value.

In the official Microsoft documentation it says that this property can be used to get the time zone from messages. We need to know the user's LocalTimeZone to make correct filters in our system: https://learn.microsoft.com/en-us/dotnet/api/microsoft.bot.schema.activity.localtimezone?view=botbuilder-dotnet-stable


BUG WHEN USING COPILOT:

  1. Messaging extension query USING COPILOT: Send a prompt to copilot in the new Microsof Teams.

meqc1

  1. Check incoming request: There is not localTimezone in the request.
{
  "type": "invoke",
  "id": "xxx",
  "timestamp": "2024-04-04T01:23:34.4625434Z",
  "localTimestamp": "2024-04-04T01:23:34.4625442+00:00",
  "serviceUrl": "https://smba.trafficmanager.net/teams",
  "channelId": "m365extensions",
  "from": {
    "id": "xxx",
    "name": "xxx",
    "aadObjectId": "xxx"
  },
  "conversation": {
    "tenantId": "xxx",
    "id": "outlook:xxx",
    "aadObjectId": "xxx"
  },
  "recipient": {
    "id": "xxx",
    "name": "xxx"
  },
  "locale": "en-us",
  "entities": [{ "type": "clientInfo", "locale": "en-us" }],
  "channelData": {
    "tenant": { "id": "xxx" },
    "source": { "name": "copilot" }
  },
  "value": {
    "commandId": "xxx",
    "parameters": [{ "name": "xxx", "value": "xxx" }],
    "queryOptions": { "skip": 0, "count": 10 }
  },
  "name": "composeExtension/query"
}
  1. Check Bot Framework SDK for C#: The LocalTimeZone property in TurnContext is null.

bf1


SUCCESSFUL REQUEST WHEN NOT USING COPILOT

  1. Messaging extension query WITHOUT USING COPILOT: Send a message extensions in Microsoft Teams.

meqc2

  1. Check incoming request: The localTimezone is present in the request.
{
  "name": "composeExtension/query",
  "type": "invoke",
  "timestamp": "2024-04-04T01:20:30.421Z",
  "localTimestamp": "2024-04-04T14:20:30.421+13:00",
  "id": "f:xxx",
  "channelId": "msteams",
  "serviceUrl": "https://smba.trafficmanager.net/apac/",
  "from": {
    "id": "29:xxx",
    "name": "xxx",
    "aadObjectId": "xxx"
  },
  "conversation": {
    "conversationType": "personal",
    "tenantId": "xxx",
    "id": "a:xxx"
  },
  "recipient": {
    "id": "28:xxx",
    "name": "xxx"
  },
  "entities": [
    {
      "locale": "en-US",
      "country": "US",
      "platform": "Windows",
      "timezone": "Pacific/Auckland",
      "type": "clientInfo"
    }
  ],
  "channelData": {
    "tenant": { "id": "xxx" },
    "source": { "name": "compose" }
  },
  "value": {
    "commandId": "xxx",
    "parameters": [{ "name": "initialRun", "value": "true" }],
    "queryOptions": { "count": 25, "skip": 0 }
  },
  "locale": "en-US",
  "localTimezone": "Pacific/Auckland"
}
  1. Check Bot Framework SDK for C#: The LocalTimeZone property has value in ITurnContext :)

bf2

P.S., Some values in the request were replaced with "xxx" just for security reasons.


STACK VERSION:

All packages used in the project:

pk


Thank you, I look forward to your prompt response, Regards

Reproduction Steps

BUG:
1. Send a message to the co-pilot in Microsoft Teams (desktop and web versions)
2. Check `Activity.LocalTimezone` in Bot Framework SDK for C#
3. The SDK Bot Framework has no value for the local time zone
tracyboehrer commented 2 months ago

This is not an SDK issue. LocalTimeZone is supplied in the incoming Activity JSON payload. In this case, it's not there so will of course be null. This would also be the case with LocalTimestamp.

rfessia commented 2 months ago

Thanks @tracyboehrer. Where should I report this issue? The teams ai Recommend me to post he issue in this team... https://github.com/microsoft/teams-ai/issues/1493