[Python] Mention to multiple people with Slack API

Overview

As the title says. Article for Article ⑥ written here. When I wanted to mention to multiple people, I thought about what to do and executed it as follows.

What I wanted to do

I want to mention multiple people like the red frame. a.jpeg

Where I made a mistake

Notification destination: Notation @user:<@user> Since this is a user, use " user ":" U012YTNNPB5 " **. ** (available at slack apiʻusers.list) Note that it is not " real_name ":" test_1 "`.

code

menber = ['U012JDYRD2T', 'U012X478FNZ']
tmptmp = []
for i in menber:
    tmptmp.append("<@" + i + ">")
r = map(str,tmptmp)
mojiretsu = ' '.join(r)
text = mojiretsu + "If you go to work, please stamp according to your status! !!"

① Since it must be in the form of <@user>, take out [member] one by one and substitute it for [i]. Add a string " <@ " etc. to it. (2) Since it is written as [map (str, tmptmp)], use the str () function for all the elements in the list tmptmp. ③ Add '''. Join (half-width underspace) to the list of character strings. ④ Post using this text.

What i found

I had a hard time getting the real_name, but I didn't use it in the end. You need to know in advance what to use and how to use the endpoint path parameters.

Recommended Posts

[Python] Mention to multiple people with Slack API
Post to slack with Python 3
Simple Slack API client made with Python
[Python] How to draw multiple graphs with Matplotlib
Sample to send slack notification with python lambda
Flow to complete Slack authentication with Flask (Python)
Write multiple records to DynamoDB with Lambda (Python, JavaScript)
How to operate Discord API with Python (bot registration)
Connect to BigQuery with Python
Use Trello API with python
Post from Python to Slack
Post to vim → Python → Slack
Use Twitter API with Python
Connect to Wikipedia with Python
Web API with Python + Falcon
Play RocketChat with API / Python
Call the API with python3.
Use subsonic API with python3
Post to Slack in Python
Easy to use Nifty Cloud API with botocore and python
The first API to make with python Djnago REST framework
Send experiment results (text and images) to slack with Python
Python: How to use async with
Create Awaitable with Python / C API
Link to get started with python
Connect to multiple databases with SQLAlchemy
[Python] Write to csv file with Python
Get reviews with python googlemap api
Create folders from '01' to '12' with python
Run Rotrics DexArm with python API
Try to operate Facebook with Python
Output to csv file with Python
Convert list to DataFrame with python
MP3 to WAV conversion with Python
To do tail recursion with Python2
How to get started with Python
Hit the Etherpad-lite API with Python
Post multiple Twitter images with python
[python] Read information with Redmine API
What to do with PYTHON release?
Animate multiple still images with Python
Unable to install Python with pyenv
How to use OpenPose's Python API
How to use FTP with Python
Multiple integrals with Python and Sympy
Easily post to twitter with Python 3
I want to debug with Python
[Python] Creating multiple windows with Tkinter
[Python] How to use Typetalk API
[Python] Create API to send Gmail
Operate Jupyter with REST API to extract and save Python code
Rubyist tried to make a simple API with Python + bottle + MySQL
People who are accustomed to Android programs try multithreading with Python
[September 2020 version] Explains the procedure to use Gmail API with Python
Get conversions and revenue with Google Analytics API and report to Slack
Sample to use after OAuth authentication of BOX API with Python
Links to people who are just starting data analysis with python
I tried to summarize everyone's remarks on slack with wordcloud (Python)
Image upload & download to Azure Storage. With Python + requests + REST API
I tried ChatOps with Slack x API Gateway x Lambda (Python) x RDS
Collecting information from Twitter with Python (Twitter API)