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

MicrosoftTeams channel doesn't recognize URL's

Open rjgmail88 opened this issue 8 years ago • 10 comments

Bot Info

  • SDK Platform: Node.j
  • SDK Version: v3
  • Active Channels: MS Teams
  • Deployment Environment: Azure App Service

Issue Description

I have QnA BOT which is using MS team channel. When QnA has an answer which contains URL I see it's clickable in emulator but not in teams. I feel like teams isn't able recognize url's from text. Here are the screenshots.

Code Example

Just send any string that contains any URL. Try it on emulator vs MS teams.

let results = "URL: https://github.com/Microsoft/BotBuilder/issues/new"
session.send(`${results}`);

Expected Behavior

URL's should be recognized and clickable in MS teams.

Actual Results

URL's are not recognized and clickable in MS teams.

examples:

MS teams Screen Shot 2018-06-29 at 11.13.23 AM image

emulator image

rjgmail88 avatar Jul 01 '18 20:07 rjgmail88

I used C# and met the same issue with you. Then I correct the code into [url](url)---the Markdown format. You can correct your code into the one below to have a try:

let results = "URL: [https://github.com/Microsoft/BotBuilder/issues/new](https://github.com/Microsoft/BotBuilder/issues/new)"

session.send(${results});

libihan avatar Jul 02 '18 04:07 libihan

@libihan , the link you shared gives 404 Not found.

rjgmail88 avatar Jul 02 '18 13:07 rjgmail88

Sorry, I meant that you can change your url into the [url](url) --- Markdown format, which can make your url recognized and clickable in MS teams.

libihan avatar Jul 02 '18 13:07 libihan

I believe you are talking about something like following where we set textFormat property and message object.

var msg = new builder.Message(session)
                .text("[url](url)")
                .textFormat("markdown")
                .textLocale("en-us")

            session.send(msg).endDialog();

rjgmail88 avatar Jul 02 '18 13:07 rjgmail88

I am seeing the same behavior in C#. It looks like in order to post a hyperlink in Teams you will need to use markdown like you described. It's not completely clear that this is intentional in the MS teams Bot Documentation, but it seems posting a plain hyperlink with no formatting is not supported in bots for MS Teams.

For reference this is the code I used to get a hyperlink in C#

    public async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument)
    {
        var activity = await argument;

        var reply = (Activity)activity;
        reply = reply.CreateReply(@"[https://github.com/Microsoft/BotBuilder/issues/4813](https://github.com/Microsoft/BotBuilder/issues/4813)");
        reply.TextFormat = TextFormatTypes.Markdown;

        await context.PostAsync(reply);
    }

JasonSowers avatar Jul 02 '18 14:07 JasonSowers

@JasonSowers , I am using nodejs sdk. Any thoughts on code I shared ?

rjgmail88 avatar Jul 02 '18 14:07 rjgmail88

Yeah I get that you are using node. It’s just I’m setup to test things easier in c#. Since the behavior is the same for both SDKs it seems like this is something intentional on the teams side. I’ll reach out to them and ask, but reading the documentation I linked it seems it won’t be possible from a bot. I’ll let you know what they say.

JasonSowers avatar Jul 02 '18 15:07 JasonSowers

@rjgmail88 The response was as I expected, this is just how things work for bots in teams. You will need to format your text in markdown in order to render a hyperlink.

JasonSowers avatar Jul 02 '18 15:07 JasonSowers

Thank you @JasonSowers .

rjgmail88 avatar Jul 02 '18 18:07 rjgmail88

Hi, I have an old framework - Mindlink Chatbot. It is having simple.shell script for message output. How can I render markdown via it? Currently it is just printing as plain text

pulkit23 avatar May 06 '22 13:05 pulkit23