How do you trigger a Slack Workflow when someone sends a message? I want to react to a person sending a message, preferably try to read the message they sent and respond back with some helpful links as a thread automatically.
Related
I am facing a weird bug when using my bot app to send messages in a thread.
I am sending DMs as a bot app user - the message will appear in the app channel.
When I send the first message, I get a notification from this message (right).
I get the thread ts, and then send a message again as a bot, replying in a thread. I receive the message in the channel, as a thread, but I don't get any notification.
Next I reply it as the user receiving this DM - works ok
Then, from the moment I reply to this thread, after the first interaction from the user, I start to get notifications from my own bot messages.
The issue? I'd like to get notifications from the start, doesn't matter if the user interacted with me in this thread or not. Any way to do it?
Thanks!
I am using https://slack.com/api/chat.postMessage to do it all.
Here's what I need,
A user sends a message, and my slack bot return a message that should be attached to the specific user, whose message I processed.
The image below explains it clearly, the user named Changming sends a message in Chinese, and then the slack app attaches it's translation in English, to the original message. How can I do that?
Until now, I've been able to send a block in a message, but I don't know how to attach it to the original message.
As the problem occurs, if there are multiple messages being sent in a single second, then the bot's messaged will not be in the correct position, as the bot will also take certain amount of time in processing and sending the messages back to slack.
Whenever my app posts ephemeral message to Slack channel (in response to a query by a user), I am unable to get the timestamp of my Slack app response. As I want to delete it once the user has made a selection using one of the buttons. Although I have subscribed to 'message.channels' event, I don't get a notification to my app whenever my app posts in the channel (in response to the user input), therefore, I am unable to get the timestamp of the message which I'll use to delete it. All I want is the timestamp of the message posted by my app so that I can delete it but I am unable to receive the timestamp. Please help!
For e.g. in Giphy app for Slack. Let's say the user invokes the app by calling '/giphy [dog]' where 'dog' is just an example of a search term. The app responds by sending a gif and user can either send it, shuffle to the next one or cancel it. I want a similar capability of cancelling the app response but I need the timestamp of the message in order to do so therefore I am asking for help.
Thanks.
Your approach can not work, because Slack is handling ephemeral messages differently from "normal" messages. They are only visible by one user and can not be modified by API methods (e.g. deletion).
But of course its possible to replace ephemeral messages. Here is how:
Your app can just reply to the interactive message request from Slack with a new message. That new message will by default override the original message including ephemeral messages.
You can reply in two ways:
Directly reply to the request from Slack with a message within 3 seconds
Send a message to the response_url from the Slack request within 30 minutes.
See here for the official documentation on how to respond to interactive messages.
This approach works both with interactive messages and slash commands.
See also this answer for a similar situation.
Is there a way, by means of some setting or programmatically, to allow a user on Slack to confirm that the user really wants to send a message before the message is sent? Often times we end up sending messages on the wrong channels or DMs. How can we prevent these?
Assuming by "send a message" you mean "post a message" to a channel.
Via Settings
No. There is no Slack setting to enable confirmation before a message is posting.
Programmatically
No. Its possible to retrieve all messages that are posted to a channel with a Slack app (e.g. via Events API) and then react to them, but only after the fact. To the best of my knowledge it is not possible to insert some kind of confirmation logic into the standard process of posting a message.
I am using an Azure Function to send a Proactive message to the client. How do i "reset" a conversation when a Proactive message is sent.
Within the bot, a user might be prompted for something (ex. time of day). A proactive message may get sent to them before they respond. In this scenario, I would like to reset/cancel the previous dialog and start fresh.
I am already able to reset the dialog using CancelAllDialogsAsync which works fine for user-driven messages.
I am sending my proactive message using ConnectorClient, which bypasses the framework, and sends directly to the client, thus never hitting my middleware to reset the dialog.
How can I get the proactive message sent to the framework (i can send the response from the bot no problem)
I would highly recommend you solve this by having your function send your bot a backchannel event under the context of the ConversationReference via the ConnectorClient. This way the bot maintains ownership for all the details about state and what should happen when this event occurs rather than that responsibility leaking to the function. The bot then watches for this custom event and responds to it however it sees fit.
If you need any more details let me know and I'll update my answer.