![](/img/trans.png)
[英]Sending Multiple Proactive Messages in MS teams, using Bot framework, at the exact same time
[英]Sending proactive messages to MS Teams
我無法向MS Team發送主動消息。 您可以在下面看到代碼和錯誤。 錯誤消息如下: 錯誤的對話創建參數
當我將應用程序日志放置在托管有bot的Azure門戶中時:我看到以下錯誤:Microsoft.Bot.Builder.Integration.AspNet.Core.BotFrameworkHttpAdapter:捕獲到異常:發生一個或多個錯誤。 (操作返回了無效的狀態碼“ BadRequest”)
2019-09-16T13:32:57 Microsoft.WindowsAzure.Storage.StorageException:遠程服務器返回錯誤:(409)沖突。 ---> System.Net.WebException:遠程服務器返回錯誤:(409)Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync [T](在System.Net.HttpWebRequest.GetResponse()處為Conflict.at RESTCommand
1 cmd, IRetryPolicy policy, OperationContext operationContext)--- End of inner exception stack trace ---at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand
1 cmd,IRetyPolicy策略,OperationContext operationContext)在Microsoft.WindowsAzureA.SureBlog.Details(String前綴,布爾值useFlatBlobListing,BlobListingDetails blobListingDetails,Nullable`1 maxResults,BlobContinuationToken currentToken,BlobRequestOptions選項,OperationContext operationContext)狀態)請求信息請求ID:a8f8929d-001e-0005-4693-6ccae9000000RequestDate:Mon,16 Sep 2019 13:32:57 GMTStatusMessage:容器中的Blob類型為u 被該版本識別。ErrorCode:FeatureVersionMismatch。 請你幫助我好嗎? 謝謝
MicrosoftAppCredentials.TrustServiceUrl(turnContext.Activity.ServiceUrl);
var teamConversationData = turnContext.Activity.GetChannelData<TeamsChannelData>();
var connectorClient = new ConnectorClient(new Uri(turnContext.Activity.ServiceUrl), _credentialProvider.AppId, _credentialProvider.Password);
var userId = "28:2c988176-cea6-4aaa-9a69-8ace544a43e3";
var tenantId = teamConversationData.Tenant.Id;
var parameters = new ConversationParameters
{
Members = new[] { new ChannelAccount(userId) },
ChannelData = new TeamsChannelData
{
Tenant = new TenantInfo(tenantId),
},
};
var conversationResource = await connectorClient.Conversations.CreateConversationAsync(parameters);
var message = Activity.CreateMessageActivity();
message.Text = "This is a proactive message1.";
await connectorClient.Conversations.SendToConversationAsync(conversationResource.Id, (Activity)message);
// Save any state changes that might have occured during the turn.
https://docs.microsoft.com/zh-cn/microsoftteams/platform/concepts/bots/bots-create
團隊中對V4 bot框架的支持是beta(上次聽說)。 如果主動消息有錯誤,我不會感到驚訝。 版本不匹配錯誤可能是由於團隊期望V3有效負載。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.