Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Send Periodic Ephemeral ("Hidden") Messages From a Slack Bot

I am interested in writing a Slack bot that will periodically send "ephemeral" messages to users. Ephemeral messages are messages that appear within a channel, but can only be seen by a particular user, like the responses to bot "slash commands" (e.g. "/who").

The goals here, however, are to have ephemeral messages sent periodically by the bot and:

  1. appear within the channel message stream (i.e. not in a DM/private message), and
  2. not in response to any slash command.

How do I use the APIs to create ephemeral messages like this?

like image 747
internet user Avatar asked Mar 24 '16 23:03

internet user


People also ask

What is an ephemeral message in slack?

This method posts an ephemeral message, which is visible only to the assigned user in a specific public channel, private channel, or private conversation. Ephemeral message delivery is not guaranteed — the user must be currently active in Slack and a member of the specified channel .

Can slack bots send DMS?

You may see Slackbot in channels throughout your workspace, delivering reminders and automated messages for you and your teammates. When there's a reminder or a message just for you, Slackbot will send you a DM. You can access your DM with Slackbot the same way you would find a DM with anyone else in your workspace.

What is an ephemeral message?

Ephemeral messaging is the mobile-to-mobile transmission of multimedia messages that automatically disappear from the recipient's screen after the message has been viewed. The word "ephemeral" describes something that only lasts for a short period of time.

Can slack BOT read private messages?

Yes. The contents of every private message sent between team members are visible to administrators for a Slack team.


1 Answers

Sending private messages with the "Only visible to you" tag is called "ephemeral" and seems to now be possible through the Slack API.

https://api.slack.com/methods/chat.postEphemeral

(I'm not sure since when, and why it still says "Mid Term" on their roadmap)

like image 149
Pangolin Avatar answered Oct 02 '22 12:10

Pangolin