问题
How do you send a direct message to a user in Slack, using their unique "Member ID". Slack seems to only accept a Slack handle as an acceptable username.
I'm new to Slack and thanks in advance for the help (please let me know if this needs to be moved, etc.).
回答1:
Assuming you meant user ID when you said "member ID", you can use that as channel parameter in chat.postMessage to send a direct message to that user.
Example for user with User ID U12345678
:
curl -X POST "https://slack.com/api/chat.postMessage" -H "accept: application/json" -d token=TOKEN -d channel=U12345678 - d text=Hello
来源:https://stackoverflow.com/questions/48347073/using-slack-how-do-you-send-direct-message-to-user-based-on-their-member-id