BotBuilder-MicrosoftTeams
BotBuilder-MicrosoftTeams copied to clipboard
ERROR: Activity resulted into multiple skype activities
Hi,
When i try to update a card with another card i get a message saying "Activity resulted into multiple skype activities"
Test code
Activity cardTest = new Activity();
cardTest.withType(ActivityTypes.MESSAGE).withRecipient(activity.from())
.withId(activity.id()).withFrom(activity.recipient())
.withAttachments(Arrays.asList(
new Attachment().withContentType("application/vnd.microsoft.card.thumbnail")
.withContent(new ThumbnailCard().withTitle("Thumbnail")
.withSubtitle("card").withText("Thumbnail card"))));
String actId = new BotConnectorImpl(activity.serviceUrl())
.sendToConversation(activity.conversation().id(), activity.id(), cardTest);
new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
System.out.println("Sending world");
new BotConnectorImpl(activity.serviceUrl()).updateConversation(
activity.conversation().id(), actId,
new Activity().withType(ActivityTypes.MESSAGE).withText("World")
.withId(actId)
.withAttachments(Arrays.asList(new Attachment()
.withContentType(
"application/vnd.microsoft.card.thumbnail")
.withContent(new ThumbnailCard()
.withTitle("Thumbnail new").withSubtitle("card")
.withText("Thumbnail card")))));
} catch (Exception e) {
e.printStackTrace();
}
}
`}.run();`
For the first call i get back the following response
Response{protocol=http/1.1, code=201, message=Created, url=https://smba.trafficmanager.net/inlocal-client-ss.msg/v3/conversations/a:1eqU_84Pldp0o64r8ZSkPs8tFylA2Tl6v-XdbDnRyHkZHbWtdirivh0NTYQ-Y9Ro9cUQN6Txt9HFt49Qgw56ewE7UfvQuttra2tpI0GIHDUXGMVSWiSnuVesjc4GdJuO_/activities/1529042383029}
{"id" = "1:1LOoYnwMp4chbJTW6ltBxMm1EwRp3j13gWgbS-qeY-Zs"}
And in response i get the following for which i am getting the error message
[apache-tomcat-9.0.8]: Response{protocol=http/1.1, code=400, message=Bad Request, url=https://smba.trafficmanager.net/inlocal-client-ss.msg/v3/conversations/a:1eqU_84Pldp0o64r8ZSkPs8tFylA2Tl6v-XdbDnRyHkZHbWtdirivh0NTYQ-Y9Ro9cUQN6Txt9HFt49Qgw56ewE7UfvQuttra2tpI0GIHDUXGMVSWiSnuVesjc4GdJuO_/activities/1:1LOoYnwMp4chbJTW6ltBxMm1EwRp3j13gWgbS-qeY-Zs}
Kindly let me know if anyone has a solution for this error.
Thanks
Please try the samples given in Update Message documentation.
Could you please try again by keeping only message text or attachment?
This is similar to what you reported in #125. The code is trying to update a message (1 card) to something that's going to become 2 messages (text + card). That's why it's giving the error "Activity resulted into multiple skype activities".
It's a case that we're aware of and working to enable. Until then, message updates are restricted to instances that will not result in splitting. In fact, I'd recommend only text->text or card->card updates, because card->text or vice versa is also problematic. (It works, but you could see some ugly visual artifacts until the thread is refreshed.)
Thank you for your swift response. Do you have any example in which you can only send cards and not message+card? Since the POST call requires an activity to be send.
(We are able to update simple text message but not cards with the below code)
Activity cardTest = new Activity();
cardTest.withType(ActivityTypes.MESSAGE).withRecipient(activity.from())
.withId(activity.id()).withFrom(activity.recipient()).withText("TEST - 1");
String actId = new BotConnectorImpl(activity.serviceUrl())
.sendToConversation(activity.conversation().id(), activity.id(), cardTest);
new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
System.out.println("Sending world");
new BotConnectorImpl(activity.serviceUrl()).updateConversation(
activity.conversation().id(), actId, new Activity().withId(actId)
.withType(ActivityTypes.MESSAGE).withText("TEST - 2"));
In your snippet above, it looks like withText()
is what adds the text to the activity. Omit the call to withText("World")
when creating the second activity: that way you're doing a card->card update, which should work.
The snippet above is text->text. Can you share the snippet for your attempt to do a card->card update?
Got it working. Thanks 👍
It's a case that we're aware of and working to enable. Until then, message updates are restricted to instances that will not result in splitting. In fact, I'd recommend only text->text or card->card updates, because card->text or vice versa is also problematic. (It works, but you could see some ugly visual artifacts until the thread is refreshed.)
Kindly update / reopen the issue once this is fixed if possible or let me know if there is a channel where we could see changelogs.
Is there an update on this?