title: unknown id of the message
body: <p>The script: </p>
  
  <pre><code>&gt;     results = service.users().messages().list(userId='me', labelIds=['INBOX']).execute()
  &gt;     messages = results.get('messages', [])
  &gt; 
  &gt;     if not messages:
  &gt;         print("No messages found.")
  &gt;     else:
  &gt;         print("Message snippets:")
  &gt;         for message in messages[::-1]:
  &gt;             msg = service.users().messages().get(userId='me', id=message['id']).execute()
  &gt;             print(msg['snippet'])
  &gt;             messageid = msg['id']
  &gt;             service.users().messages().delete(userId='me', id=messageid).execute()
  &gt;             break
  &gt; 
  &gt; if __name__ == '__main__':
  &gt;     main()
  </code></pre>
  
  <p>Hey,
  I wanted this program to take my oldest email, print it out, and then delete this message.
  However the I am not sure what the id is and I'm always getting errors like this:</p>
  
  <pre><code>    Message snippets:
  Google Banner Hallo Gmail, willkommen bei Google. Mit Ihrem neuen Konto können Sie Google-Produkte, ‑Apps und ‑Dienste nutzen. Für den Anfang haben wir hier einige nützliche Tipps für Sie
  . Konto
  Traceback (most recent call last):
    File "gmail.py", line 52, in &lt;module&gt;
      main()
    File "gmail.py", line 48, in main
      service.users().messages().delete(userId='me', id=messageid).execute()
    File "C:\Users\25jul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\googleapiclient\_helpers.py", line 134, in
   positional_wrapper
      return wrapped(*args, **kwargs)
    File "C:\Users\25jul\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\googleapiclient\http.py", line 907, in exe
  cute
      raise HttpError(resp, content, uri=self.uri)
  googleapiclient.errors.HttpError: &lt;HttpError 403 when requesting https://www.googleapis.com/gmail/v1/users/me/messages/171f0100542b03d1? returned "Insufficient Permission"&gt;
  </code></pre>
  
  <p>thanks for the answers,
  Julius</p>