Search code examples
slackslack-api

java slack bot integration join channel tag


I have a java app that acts like slack bot and sends text messages to slack channel. But, if I send 'Please join #mysuperchannel', the #mysuperchannel is not highlighted as a link which I can join that channel in one click. It's just a text. What should I use to get this #mysuperchannel word be highlighted and clickable in slack chat window? Sth like a tag or mark or anything else to let it know I want to get this word like a reference to the channel it represents. Thanks


Solution

  • You need to use the Slack markup language to make the channel name linkable.

    Here is syntax for linking a channel: <#C12345678|name>. Just put that in the text you are sending to the Slack channel.

    • C12345678 is the ID of the channel you want to link.
    • name is just a text that will appear as label for the link

    See here for full documentation including more examples.