I want to post a message on slack using allbegrey Slack API . The message contains links. How to do so?
com.github.allbegray
slack-api
1.7.0.RELEASE
Info:
My message is similar to this one.
Udpate
If you want to post a simple message to a channel. And your message contains a url. You use the slack markup to format the message and then call postMessage(String channel, String text). It works, but if you have attachments it does not work.
My message has attachments and I do it like this:
val text = "Nostrum dolores eaque vero voluptatibus illum quibusdam ex sapiente!"
val message = "Lorem ipsum dolor sit amet consectetur, adipisicing elit. Expedita tempora asperiores corporis hic quidem dicta maiores odit illo perferendis quaerat. Nostrum dolores eaque vero voluptatibus illum quibusdam ex sapiente!"
val webApiClient = SlackWebApiClientImpl(slackApiToken, null, 8000)
val channel = webApiClient.openDirectMessageChannel(author.slackId)
val method = ChatPostMessageMethod(channel, text)
val attachment = Attachment()
attachment.author_name = author.name
attachment.author_icon = author.profileImageUrl
attachment.author_link = "
https://XXXX.slack.com/team/${author.slackId}"
attachment.text = message
attachment.pretext = message
method.attachments = listOf(attachment)
method.isLink_names = true
webApiClient.postMessage(method)
Doing so, I get the message but without clickable links.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)