-
-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to format URLs #109
Comments
This is via web and/or real-time API? Post a simple repro? |
The following code results in an incorrect result due to it being sent as
|
This client is certainly not encoding this message AFAIK, but I could be wrong. From here you should be able to debug it. I bet we send the right message but slack encodes it server-side. |
I have been unable to debug or figure out where/why this is happening. All that I'm aware of is that it's impossible to send through labeled URLs using this client. |
Worked with web API: require 'slack-ruby-client'
Slack.configure do |config|
config.token = ENV['SLACK_API_TOKEN']
fail 'Missing ENV[SLACK_API_TOKEN]!' unless config.token
end
client = Slack::Web::Client.new
client.auth_test
client.chat_postMessage(channel: '#general', text: 'Please visit <http://www.example.com|my website>!', as_user: true) In your code you can do: client.web_client.chat_postMessage(channel: data.channel, text: 'Please visit <http://www.example.com|my website>!') Formatting messages in https://api.slack.com/rtm says the following. Related, slackapi/python-rtmbot#50 and slackapi/hubot-slack#114 are examples of the same problem and are saying that this isn't supported server-side in the RTM API. |
Fantastic, thank you very much for finding this out and following up. Sorry for having wasted your time (perhaps it might be worth making a small note about this in your own gem's documentation?) |
I would appreciate a PR that clarifies the README anywhere you see fit! |
Any URLs formatted with a label, for example:
Please visit <http://www.example.com|my website>
do not get formatted correctly as per Slack spec with just text "my website" as a link to http://www.example.com, instead it becomes a literal<http://www.example.com|my website>
when appearing within Slack.I'm using slack-ruby-client 0.7.7
The text was updated successfully, but these errors were encountered: