title: Get a user's API key for using in Slack
body: <p>So I'm building a small Slack bot that I want multiple users to be able to use in different Slack teams. So far the workflow is like this:</p>
  
  <ol>
  <li>User signs up on website.</li>
  <li>User connects with an API provider and receives their OAuth credentials. The access token for each user is saved in the database.</li>
  <li>User adds Slack bot to their team.</li>
  </ol>
  
  <p>With hardcoded API values the bot retrieves the desired data, but what is the best way for the bot to be able to get the appropriate data for each Slack team? </p>
  
  <p>I obviously don't want a user to need to keep signing into the website etc, so how do I associate the slack team with the Laravel user and then pull the relevant API data?</p>
  
  <p>For some example code, imagine that I have a Strava access token stored in my DB for a user and I want to call the API:</p>
  
  <pre><code>$botman-&gt;hears('runstats', function ($bot) {
      $payload = \Strava\Account::get(
        \Auth::user()-&gt;strava_id,
        array('api_key' =&gt; "here_is_a_secret_key")
    );
  
  $bot-&gt;reply($payload-&gt;monthly_kms);
  </code></pre>
  
  <p>This works fine when I query from my web interface as I'm signed into my website and it spits back <code>123km</code> as an example.</p>
  
  <p>Obviously when I'm signed into Slack then there's no <code>Auth::user</code> instance and so it cannot find the relevant Strava ID. That's what I want to be able to retrieve for the relevant Slack user. I envisage it being installed in multiple Slack workspaces.</p>