botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Skype] Message formatting: Cannot add break line \n\n into the message?

Open chuotnhat1985 opened this issue 8 years ago • 6 comments

Bot Info

  • SDK Platform: .NET
  • SDK Version: SDK 4.6.1
  • Active Channels: Skype 7.40.0.151
  • Deployment Environment: IIS 7.0

Issue Description

As title, I cannot add break line \n\n or
into the message on Skype

Code Example

            var connector = new ConnectorClient(conversation.ServiceUrl);
            IMessageActivity activityMessage = Activity.CreateMessageActivity();

            activityMessage.ChannelId = conversation.ChannelId;
            activityMessage.From = botAccount;
            activityMessage.Recipient = userAccount;
            activityMessage.Conversation = new ConversationAccount(id: conversation.ConversationId);
            activityMessage.Text = "abc \n\n xyz";
            activityMessage.Locale = "en-Us";
            activityMessage.TextFormat = TextFormatTypes.Markdown;
            Microsoft​App​Credentials.TrustServiceUrl(conversation.ServiceUrl.ToString());

            var result = connector.Conversations.SendToConversationAsync((Activity)activityMessage);

image

chuotnhat1985 avatar Jan 30 '18 10:01 chuotnhat1985

Which Skype client are you using? I Just tested on windows version 7.40.0.103 and it appears to be working as intended for line breaks like this var reply = activity.CreateReply("kljkj \n\n asdklfj");

image

JasonSowers avatar Jan 30 '18 16:01 JasonSowers

Skype version 7.40.0.151. Are there any difference between CreateReply and CreateMessageActivity. I made anything, but still not break line in the skype.

chuotnhat1985 avatar Jan 31 '18 07:01 chuotnhat1985

I tried with your code to reproduce this as well, and was unable to reproduce.

JasonSowers avatar Jan 31 '18 22:01 JasonSowers

This is full code that using to send the message to skype group when bot get the data from database. Conversation object is a model. You can change the other one. `var userAccount = new Microsoft.Bot.Connector.ChannelAccount { Id = conversation.Sender.Id, Name = conversation.Sender.Name };

            var botAccount = new Microsoft.Bot.Connector.ChannelAccount
            {
                Id = conversation.Recipient.Id,
                Name = conversation.Recipient.Name
            };

            var connector = new ConnectorClient(conversation.ServiceUrl);
            IMessageActivity activityMessage = Activity.CreateMessageActivity();

            activityMessage.ChannelId = conversation.ChannelId;
            activityMessage.From = botAccount;
            activityMessage.Recipient = userAccount;
            activityMessage.Conversation = new ConversationAccount(id: conversation.ConversationId);
            activityMessage.Text = message;
            activityMessage.Locale = "en-Us";
            activityMessage.TextFormat = TextFormatTypes.Markdown;
            Microsoft​App​Credentials.TrustServiceUrl(conversation.ServiceUrl.ToString());

            var result = connector.Conversations.SendToConversationAsync((Activity)activityMessage);`

chuotnhat1985 avatar Feb 01 '18 02:02 chuotnhat1985

hi @JasonSowers on skype for business it's not working with \n\n. I test with bot simulator and web channel it's working. Any suggestion?

band888888 avatar Feb 11 '18 01:02 band888888

Please open a new issue if you are experiencing problems still.

JasonSowers avatar Jun 25 '18 14:06 JasonSowers