tipu
tipu

Reputation: 9604

how do you build a bot for multiple people to use when you hardcode a token?

I'm using this library. In the examples, it uses a hardcoded token. If I wanted to put this app on the Slack marketplace, how do I dynamically "listen" to multiple app tokens using:

token = "xoxp-28192348123947234198234"  # found at https://api.slack.com/web#authentication
sc = SlackClient(token)
if sc.rtm_connect():
    while True:
        print sc.rtm_read()
        time.sleep(1)

Do I need to make a new bot instance for every integration?

Upvotes: 0

Views: 454

Answers (1)

Matthieu
Matthieu

Reputation: 1239

A token = a team. If you hardcode your token, it can be used only by the team who supplied the token. That would be typical for a custom integration, but it is not compatible with an app you'd release on the Slack directory.

A typical solution is to store each token in your database (using strong encryption!) and, indeed, fire a new bot RTM connection for each team.

Upvotes: 2

Related Questions