Comments (11)
i can shed some light on this. there's two problems that i see:
- this adapter uses the RTM API for Slack. the only way to update a message is to use Web API method
chat.update
. - in order to use
chat.update
, you must know the message'schannel
andts
properties.
the first problem is pretty easy to solve, because you can create your own WebClient
object. first you would npm install --save @slack/client
in your project, then add a few lines into your script, like so:
# import the Web client code from the node-slack-sdk
{WebClient} = require '@slack/client'
module.exports = (robot) ->
# instantiate a Web client using the same bot token as the internal RTM client
web = new WebClient(robot.adapter.client.rtm.token)
# the rest of your script follows...
the second problem is a little harder to solve. once a message is already sent, the adapter needs to return that message to your code so you can use the channel
and ts
values. unfortunately, the adapter doesn't currently support this, but its close. it looks like the SlackBot#send
method needs to detect whether the last item in messages...
is a function, and if so use that as the callback. i think its worth making a new issue to track this feature, so i'm opening #473.
from hubot-slack.
Curious: what use case do you have for this?
from hubot-slack.
When a deployment is underway for example, it would be great for our Hubot to send back status updates within the same chunk of text on screen. It would also allow the use of one preformatted
block which will make his output cleaner and skinnier
from hubot-slack.
are there any news on that one?
i would have another use case :
i'd like to be able to add tags to a message, but sending the original message to a keyphrase extraction service and update the original message with found keywords..
wkr turnguard
from hubot-slack.
Sounds cool.
The new adapter is dropping soon, hopefully we'll see something like this in there. Would be fantastic for ongoing updates that take a long time, rather than spamming messages one after the other.
from hubot-slack.
As I mentioned over in #16 the API used by the new adapter supports this - but we haven't yet built support into hubot-slack, mostly because we've not worked out how it would work in the context of hubot. Suggestions are welcome!
from hubot-slack.
👍 This would be such an awesome feature
On to implementation ideas: Maybe you could return the message object you send to the server and give it methods to update and delete the text. It would probably need changes in your node-slack-client as well, but it shouldn't be too big of a change.
I'm not sure about garbage collection on these message objects though, but they should stick around as long as a hubot script is keeping them referenced.
from hubot-slack.
thanks to slackapi/node-slack-sdk#14, the next version of node-slack-client will have the ability to edit messages. The only question left is how we'd implement this inside hubot's framework!
from hubot-slack.
As I've already commented on my pull request on node-slack-client, you get
the message object passed back, thanks to coffee script awesomeness you get
it passed through all hubot and node-slack-client methods, not entirely
sure if I changed something in hubot-slack, I'll check that when I get home.
You'd then just save the message object and modify it when you need to.
Am 31.01.2015 02:03 schrieb "Paul Hammond" [email protected]:
thanks to slackapi/node-slack-sdk#14
slackapi/node-slack-sdk#14, the next version
of node-slack-client will have the ability to edit messages. The only
question left is how we'd implement this inside hubot's framework!—
Reply to this email directly or view it on GitHub
#91 (comment).
from hubot-slack.
@paulhammond hi, just wondering; was this ever implemented? if not, how can I use it anyways?
I couldn't find a way and i really need to update sent messages
thanks
from hubot-slack.
Would also really like to know how to update messages. Been digging through documentation and PRs and can't figure out how.
from hubot-slack.
Related Issues (20)
- Get the last reply in a thread HOT 4
- @slack/client is no longer developed, and its dependency "ws" has a security vulnerability HOT 2
- Replace RTM API with Event API for hubot slack adapter HOT 5
- Change the default settings to "useRtmConnect: true"
- Hubot failing to set up with error: Response not OK: method_deprecated HOT 4
- Problem setting up slack token HOT 4
- @slack/client dependency "async" has a security vulnerability HOT 2
- Best Interior Designers in Noida
- Can not trigger listener sometimes. HOT 6
- After SlackClient#send(), I can not receive message sometimes HOT 5
- DEBUG Received file_shared message from: undefined, file_id: F03PMLTMBNE HOT 4
- How to HOT 1
- unable to get response from hubot HOT 3
- App user who is initiating action is identified as channel instead of App name HOT 5
- Port hubot-slack away from @slack/client? HOT 2
- Rtm.start not getting replaced by rtm.connect HOT 6
- slack bot respond only once in the thread message HOT 3
- RTMClient failed to connect HOT 15
- hubot@>4.0.0 Cannot load adapter HOT 11
- Deleted Message Event HOT 2
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 hubot-slack.