title: Sending my first message on the slack API
body: <p>I registered my first app, and it looks like this:
  <a href="https://i.stack.imgur.com/0Vblw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0Vblw.png" alt="enter image description here"></a></p>
  
  <p>All of the fields are populated below the screen shot.</p>
  
  <p>Now, I have some basic python code using the examples found on <a href="https://github.com/slackapi/python-slackclient" rel="nofollow noreferrer">their repo</a>.</p>
  
  <p>I create the following test script:</p>
  
  <pre><code>import traceback
  app_id = 'FAKE.VALUE'
  client_id = 'FAKE.VALUE'
  client_secret = 'FAKE.VALUE'
  signin_secret = 'FAKE.VALUE'
  verification_token = 'FAKE.VALUE'
  
  items = locals()
  
  import os
  import slack
  
  items = locals().copy()
  
  for k in items:
  
      if '__' not in k:
          val = items[k]
  
          try:
              client = slack.WebClient(token=val)
  
              response = client.chat_postMessage(
                  channel='CE476K9HT',
                  text='Hello-----' + str(val))
  
              print(response)
          except:
              print(k)
              traceback.print_exc()
              print('-'*50)
  </code></pre>
  
  <p>But all of the responses I get say:</p>
  
  <pre><code>The server responses with: {'ok':False,'error':'invalid_auth'}
  </code></pre>
  
  <p>For some reason, is it necessary to use path variables? </p>
  
  <p>It is unclear to me what type of auth is required here.</p>
  
  <hr>
  
  <p>After doing what Erik suggested,</p>
  
  <p><a href="https://i.stack.imgur.com/ld84Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ld84Y.png" alt="enter image description here"></a></p>
  
  <p>I have a <code>xoxp</code> code and registered the redirect url to <code>http://localhost</code>.</p>
  
  <p>and added the following scopes:
  <a href="https://i.stack.imgur.com/D1R2D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D1R2D.png" alt="enter image description here"></a></p>
  
  <p>and updated my code to look like:</p>
  
  <pre><code>oauth_token ='xoxp-*****************'
  
  import os
  import slack
  
  items = locals().copy()
  
  client = slack.WebClient(token=oauth_token)
  
  response = client.chat_postMessage(
      channel='my_channel_id',
      text='Hello-----')
  </code></pre>
  
  <p>I got my channel ID from the url:</p>
  
  <pre><code>https://app.slack.com/client/FOO/my_channel_id
  </code></pre>
  
  <p>When I run my code, I get the following back:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/usr/git/slack_messaging/slack_messaging.py", line 20, in &lt;module&gt;
      text='Hello-----')
    File "/home/usr/git/python-slackclient/slack/web/client.py", line 382, in chat_postMessage
      return self.api_call("chat.postMessage", json=kwargs)
    File "/home/usr/git/python-slackclient/slack/web/base_client.py", line 172, in api_call
      return self._event_loop.run_until_complete(future)
    File "/home/usr/anaconda2/envs/beer/lib/python3.7/asyncio/base_events.py", line 573, in run_until_complete
      return future.result()
    File "/home/usr/git/python-slackclient/slack/web/base_client.py", line 241, in _send
      return SlackResponse(**{**data, **res}).validate()
    File "/home/usr/git/python-slackclient/slack/web/slack_response.py", line 176, in validate
      raise e.SlackApiError(message=msg, response=self)
  slack.errors.SlackApiError: The request to the Slack API failed.
  The server responded with: {'ok': False, 'error': 'missing_scope', 'needed': 'chat:write:user', 'provided': 'admin,identify'}
  </code></pre>
  
  <p>Process finished with exit code 1</p>