Skip to content

Commit 6ec1549

Browse files
Shane DeWaelRoach
authored andcommitted
Add chat.postEphemeral to README and basic_usage (#207)
1 parent ab6d0e6 commit 6ec1549

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

README.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,25 @@ There are some unique options specific to sending IMs, so be sure to read the **
9494
section of the `chat.postMessage <https://api.slack.com/methods/chat.postMessage#channels>`_
9595
page for a full list of formatting and authorship options.
9696

97+
Sending an ephemeral message, which is only visible to an assigned user in a specified channel, is nearly the same
98+
as sending a regular message, but with an additional ``user`` parameter.
99+
100+
.. code-block:: python
101+
102+
from slackclient import SlackClient
103+
104+
slack_token = os.environ["SLACK_API_TOKEN"]
105+
sc = SlackClient(slack_token)
106+
107+
sc.api_call(
108+
"chat.postEphemeral",
109+
channel="#python",
110+
text="Hello from Python! :tada:",
111+
user="U0XXXXXXX"
112+
)
113+
114+
See `chat.postEphemeral <https://api.slack.com/methods/chat.postEphemeral>`_ for more info.
115+
97116

98117
Replying to messages and creating threads
99118
*****************************************

docs-src/basic_usage.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,25 @@ There are some unique options specific to sending IMs, so be sure to read the **
3838
section of the `chat.postMessage <https://api.slack.com/methods/chat.postMessage#channels>`_
3939
page for a full list of formatting and authorship options.
4040

41+
Sending an ephemeral message, which is only visible to an assigned user in a specified channel, is nearly the same
42+
as sending a regular message, but with an additional ``user`` parameter.
43+
44+
.. code-block:: python
45+
46+
from slackclient import SlackClient
47+
48+
slack_token = os.environ["SLACK_API_TOKEN"]
49+
sc = SlackClient(slack_token)
50+
51+
sc.api_call(
52+
"chat.postEphemeral",
53+
channel="#python",
54+
text="Hello from Python! :tada:",
55+
user="U0XXXXXXX"
56+
)
57+
58+
See `chat.postEphemeral <https://api.slack.com/methods/chat.postEphemeral>`_ for more info.
59+
4160
--------
4261

4362
Replying to messages and creating threads

0 commit comments

Comments
 (0)