Search code examples
node.jsbotframeworkazure-bot-service

How can I add a hyperlink in a Azure bot message text


I have recently started creating a Azure Bot in Node js. I want to add a hyperlink in one of the bot response and send a proactive response after user has clicked on it. Something like:

Please click this link to complete the payment.

and the link should be a hyperlink that will redirect to an endpoint.

I have tried finding a way to achieve it but so far, I haven't been able to achieve. I have seen the following link:

https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-send-activity?view=azure-bot-service-4.0

https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-add-media-attachments?view=azure-bot-service-4.0&tabs=javascript

Can some one suggest me the way to achieve this.


Solution

  • You can use markdown syntax.

    The text must be treated as markdown formatting and rendered on the channel as appropriate.

    Hyperlink markdown syntax :

    [click this link](https://www.google.com/)
    

    As per your code it would look like the following:

    Please [click this link](www.greetings.com) to complete the payment 
    

    Reference:

    1. Format text in chatbot
    2. Markdown syntax