I'm installing a Teams bot and adding it to a team. When I add it to the team, on the initial call I get the "conversationUpdate" event correctly, in OnTurnAsync. The issue I'm running into is that any call to get the team itself is failing because there is nothing there, that I can see, for getting the Id to call to get the team data.
I want to be able to add it to the team, get that event and then get the data related to the team it was added to.
Here is what I'm trying.
private const string ActOnType = "conversationUpdate";
public override async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default)
{
if (IsConversationUpdate(turnContext))
{
// This fails because TeamsGetInfo is returning null
var teamDetails = await TeamsInfo.GetTeamDetailsAsync(turnContext, turnContext.Activity.TeamsGetTeamInfo().Id, cancellationToken);
}
}
private bool IsConversationUpdate(ITurnContext turnContext) => string.Equals(turnContext.Activity.Type,
ActOnType, StringComparison.InvariantCultureIgnoreCase);
Other notes...turnContext.Activity.TeamsGetChannelId()
is null, as is ChannelData.
Any further calls have the channel data, but the initial one where I add the bot to the team does not have any.
Adding my JSON from the call
{
"membersAdded": [
{
"id": "29:1HqtPeQvYpNL682R_NeBMndg6kYbZbBHsZliZdAT2xWsJWzS0_b50S1ijo2hmPu5i0HTrvqPiOBxqpbtJjS7zyja",
"aadObjectId": "{valid guid}"
},
{
"id": "28:{valid guid}"
}
],
"type": "conversationUpdate",
"timestamp": "2021-01-11T18:15:49.9118003Z",
"id": "f:{valid guid}",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/amer/",
"from": {
"id": "29:1HqtPeQvYpNL682R_NeBMndg6kXaZbBHsZliZdAT2xWsJWzS0_gOS1ijo2hmPu5i0HTrvqPiOBxqpbtJjS6zyjA",
"aadObjectId": "{valid guid}"
},
"conversation": {
"conversationType": "personal",
"tenantId": "{valid guid}",
"id": "a:1UgWdBcfpF4JUtOCCjQZsvhjl-QK9YBBnALG7ACgA0QdKx_xGICsQ3d6l94t_pPed7fvtnwSnRlYcWe7kXT7dStP-YCtuvliI8GPZj9Sd5P2wHsBAAn1ibwdad4Lq-O3B"
},
"recipient": {
"id": "28:{valid guid}",
"name": "LocalBot"
},
"channelData": {
"tenant": {
"id": "{valid guid}"
}
}
}