Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: Activity resulted into multiple skype activities #126

Open
register9091 opened this issue Jun 15, 2018 · 7 comments
Open

ERROR: Activity resulted into multiple skype activities #126

register9091 opened this issue Jun 15, 2018 · 7 comments

Comments

@register9091
Copy link

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

@Wajeed-msft
Copy link
Contributor

Please try the samples given in Update Message documentation.

Could you please try again by keeping only message text or attachment?

@aosolis
Copy link
Collaborator

aosolis commented Jun 15, 2018

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.)

@register9091
Copy link
Author

register9091 commented Jun 15, 2018

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"));

@aosolis
Copy link
Collaborator

aosolis commented Jun 15, 2018

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.

@aosolis
Copy link
Collaborator

aosolis commented Jun 15, 2018

The snippet above is text->text. Can you share the snippet for your attempt to do a card->card update?

@register9091
Copy link
Author

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.

@jmnsf
Copy link

jmnsf commented Jul 14, 2020

Is there an update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants