Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to post a direct message from Bot to User based on UserID #87

Open
sdbarrington opened this issue May 12, 2017 · 1 comment
Open

Comments

@sdbarrington
Copy link

Every time I post, they end up in the SlackBot channel... is there a para I'm missing?

@ZeroDragon
Copy link

ZeroDragon commented Sep 22, 2017

you need to open (re-open) an im channel with the user

const postMessageToUserById = async (userID, message, opts={}) => {
  const { channel: { id: channelID } } = await bot.openIm(userID);
  bot.postMessage(channelID, message, opts)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants