Comments (4)
This is really a Slack API question, but looking at chat_postMessage
it looks like this is controlled by the value of broadcast
? Try setting it to false
?
https://api.slack.com/methods/chat.postMessage#arg_reply_broadcast
from slack-ruby-bot.
Hi,
NO, not using chat_postMessage... using client.say method to post it in slack channel.
Issue is not happening when message is sent to slack channel from my app... facing this issue only when a user post a command in slack channel... immediately it is posted as direct message in the channel...
My code:
require "uri"
require "net/http"
module SlackMathbot
module Commands
class Calculate < SlackRubyBot::Commands::Base
command 'Create ticket' do |client, data, _match|
url = URI("https://slack.com/api/conversations.history?channel=#{data.channel}&latest=#{data.thread_ts}&inclusive=true&limit=1")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = ""
response1 = https.request(request)
resp1 = response1.read_body
puts resp1
ui_name = resp1.split("Transcation Name")[1].split("\\n")[0].split(" ")[2]
error_class = resp1.split("Error class")[1].split("\\n")[0].split(" ")[2]
error_path = (resp1.split("Path")[1].split("\\n")[0].split(" ")[2]).delete('\\')
title = "#{ui_name} #{error_class} - #{error_path}"
url = URI("https://freshworks.freshrelease.com")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Token token="
request["Content-Type"] = "application/json"
request.body = "{\"title\":\"#{title}\",\"issue_type_id\":,\"project_id\":12111,\"tags\": [\"test\"]}"
response = https.request(request)
resp = response.read_body
# get_key(resp,data)
key = resp.split("key")[1].split(",")[0].split(/\s*-\s*/)[1].split(/\"/)[0]
fr_url = "https://freshworks.freshrelease.com"
client.say(channel: data.channel,thread_ts: data.event_ts, text: "Ticket created - #{fr_url}")
end
end
end
end
from slack-ruby-bot.
This is the response i got when i posted a command in slack channel:
{"ok":true,"channel":"channel_id","ts":"1607755792.000700","message":{"client_msg_id":"client_id","type":"message","text":"<@user_id> create ticket","user":"user_id","ts":"1607755792.000700","team":"team_id","blocks":[{"type":"rich_text","block_id":"tDr","elements":[{"type":"rich_text_section","elements":[{"type":"user","user_id":"user_id"},{"type":"text","text":" create ticket"}]}]}],"thread_ts":"1604574561.000500"}}
Here, thread_ts and ts are different... is it because of that?
If so, how to solve it... where we need to change...
from slack-ruby-bot.
This is really a Slack API question, I don't know more than the documentation here. The say
implementation is a dumb wrapper.
I would switch to chat_postMessage
and call it a day.
Please note that real-time bots are not even accepted in the slack directory any more, you should be using a bot with granular permissions. read this
from slack-ruby-bot.
Related Issues (20)
- Getting lots of 429 rate limit errors on https://slack.com/api/rtm.start calls HOT 7
- Graceful shutdown HOT 1
- Testing other code execution inside a command HOT 8
- Deployment tutorial needs update HOT 2
- DMing self produces Sorry @Slackbot, I don't understand that command! HOT 1
- Migration to non-legacy bots HOT 6
- Consider splitting RSpec shared behaviours and development dependencies HOT 4
- Where can i find more info on the client.say method? HOT 7
- Remove support for Giphy
- Extract attachments text
- without mention in channel bot can't reply HOT 1
- Upload a file? HOT 1
- Pongbot does not run on linux mint 19 HOT 4
- Testing for two outputs from a command HOT 5
- is there an example for how to implement a conversational bot using slack-ruby-bot? HOT 1
- Missing concurrency - Add faye-websocket to your gemfile -- It's already in my Gemfile HOT 1
- Clarification of MIGRATION.md HOT 8
- Is this repo really legacy, there is still a use case? HOT 3
- Repeated 429 (ratelimited) errors from slack HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from slack-ruby-bot.