0

I have a bot and through chat.postMessage endpoint, I'm able to send message to a channel. I'm also about to retrieve the list of users in slack using users.list. I'm trying to 'get' the list of users and then send a slack message to a particular user (who's not a bot). chat.postMessage accepts only channel (id) as input (that starts with C) but not user id (that starts with U).

How do I achieve this?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 1
    Does this answer your question? [How to send direct messages to a user as app in app channel](https://stackoverflow.com/questions/47753834/how-to-send-direct-messages-to-a-user-as-app-in-app-channel). I assume it does since [you reference it as the solution in your answer](https://stackoverflow.com/a/72006445/3025856). If so, this question should be closed as a duplicate, so the prior question is prioritized for people looking for a solution to this problem in the future. – Jeremy Caney Apr 25 '22 at 23:42
  • Yes Jeremy, the question can be closed as duplicate – Matheswaran Kanagarajan Apr 27 '22 at 01:05

1 Answers1

0

https://stackoverflow.com/a/70366423/3119443

Got answer from this post. Basically, I need to get channel Id from conversations.open method and then use chat postmessage.