我为团队开发了消息传递扩展。我希望它仅适用于专门安装该应用程序的团队。那有可能吗?我找不到任何相关信息,但我的用例似乎并不牵强,因此我希望它是可能的。
用例:团队成员使用外部系统注册案例。我希望他们能够在外部系统中与团队相对应的项目站点内搜索和引用案例。我在指向项目站点的常规通道中添加了一个选项卡,并且消息传递扩展使用该选项卡的contentUrl来查询正确的案例列表。我不希望扩展在团队渠道之外提供。默认情况下,该扩展似乎在每个聊天输入选项中都可用。
答案 0 :(得分:1)
消息扩展名没有定义范围,将它们安装在团队中后即可使用。当前,不可能限制在一个团队中显示消息扩展名
答案 1 :(得分:0)
我最终收到了一张处理错误的卡片:
private MessagingExtensionResponse errorResponse(string title, string errorText)
{
MessagingExtensionResult composeExtensionResult = new MessagingExtensionResult
{
Type = "result",
AttachmentLayout = "list",
Attachments = new List<MessagingExtensionAttachment>(),
};
ThumbnailCard h = new ThumbnailCard()
{
Title = title,
Text = errorText,
};
composeExtensionResult.Attachments.Add(h.ToAttachment().ToMessagingExtensionAttachment());
var messagingExtensionResponse = new MessagingExtensionResponse();
messagingExtensionResponse.ComposeExtension = composeExtensionResult;
return messagingExtensionResponse;
}
尽管能够对扩展进行范围划分会很好,但是这样我可以捕获更多的无效用法。例如:
var currentTeam = new TeamDetails();
IList<ChannelInfo> currentTeamChannels = new List<ChannelInfo>();
try
{
currentTeam = await TeamsInfo.GetTeamDetailsAsync(turnContext, turnContext.Activity.TeamsGetTeamInfo().Id, cancellationToken);
currentTeamChannels = await TeamsInfo.GetTeamChannelsAsync(turnContext, turnContext.Activity.TeamsGetTeamInfo().Id, cancellationToken);
}
catch
{
return errorResponse("Permission error", "This app has no permissions to this team / channel. Please add the app to this team / channel.");
}
从这个问题中得到了建议:Is it possible for a teams messaging extension to return a plaintext response instead of a card?