tcblue
tcblue

Reputation: 199

Slack API quote the message

how can I quote a message sent with the Slack api? I couldn't find a method for this function in the documentation. Do you have any suggestions?

enter image description here

Upvotes: 1

Views: 916

Answers (2)

tcblue
tcblue

Reputation: 199

I solved the problem by making unfurl_links = true with chat.postMessage method. In order to show the text without a link in the message, text = Test <www.example.com| > in url I solved the problem by leaving a space after the "|" sign.

Here is ex. cURL:

curl --location --request POST 'https://slack.com/api/chat.postMessage' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Bearer xoxb-xxxx' \
--data-urlencode 'channel=#urltest' \
--data-urlencode 'text=*TEST*<https://xx.slack.com/archives/xx/p16547134235899399| >' \
--data-urlencode 'unfurl_links=true' 

enter image description here

Upvotes: 0

Colm Doyle
Colm Doyle

Reputation: 3858

It's not currently possible to "quote" messages in the same way that the native quote feature does this, but if you include a permalink to the message in the body of the new message, the client should unfurl it for a similar look and feel.

Screenshot of Slack message posted via API with link to existing message

Upvotes: 2

Related Questions