Is it possible to have hubot to send a DM or reply in a thread to a person joining a channel?
I know i can do the below actions but non of them fulfils my requirements:
i have tried e.g.:
also tried e.g. res.message.thread_ts but that just throws an error.
thanks
x in one of the [ ])x in each of the [ ])hubot-slack version:
node version:
OS version(s):
CentOS Linux release 7.9.2009 (Core)
Hey @magander3 馃憢
You can send a DM to the user who joined the channel using postMessage and the user ID as the channel. The message will arrive in the Slackbot DM and come from your bot:
# Send a dm when a user enters a channel
robot.enter (res) ->
robot.adapter.client.web.chat.postMessage(
res.message.user.id,
'Howdy'
);
You can send a message as a thread reply using the follow code, but I'm not sure that it'll work for your situation. What would the main message be that's replied to? Unfortunately, you cannot thread reply to a user has joined #channel system message. :(
# Reply in a thread when a user enters a channel
# NOTE: does not work because thread replies not supported for system messages
robot.enter (res) ->
robot.adapter.client.web.chat.postMessage(
res.message.user.room,
'Howdy',
{ thread_ts: res.message.ts }
);
Hope that helps and let me know how it goes!
Hey @mwbrooks
That works like a charm.馃憢馃憢馃憢馃憢
Tnx a lot
Most helpful comment
Hey @mwbrooks
That works like a charm.馃憢馃憢馃憢馃憢
Tnx a lot