title: How do I edit a sent message using Telegram's python bot API?
body: <p>The documentation (<a href="https://core.telegram.org/bots/api#editmessagetext" rel="noreferrer">https://core.telegram.org/bots/api#editmessagetext</a>) says that I need to specify a message ID to edit, but I have no idea how to go about getting that message ID.</p>
  
  <p>I've tried setting the ID as a variable:</p>
  
  <pre><code>import telepot
  from telepot.namedTuple import InlineKeyboardMarkup, InlineKeyboardButton
  
  messageEditID = bot.sendMessage(&lt;location ID&gt;, "Test", reply_markup=InlineKeyboardMarkup(inline_keyboard=[[InlineKeyboardButton(text="Testing", callback_data="test"]]))['message_id']
  </code></pre>
  
  <p>because the POST data for such a message would be</p>
  
  <pre><code>{"message_id":1140126,"chat":{"title":"&lt;location name&gt;","type":"supergroup","id":&lt;location ID&gt;},"date":1477960655,"from":{"username":"&lt;bot username&gt;","first_name":"&lt;bot name&gt;","id":&lt;bot ID&gt;},"text":"Test"}
  </code></pre>
  
  <p>and then calling it back based on the inline reply data</p>
  
  <pre><code>if msg['data'] == 'test':
      bot.editMessage(messageEditID, "Did it work?")
  </code></pre>
  
  <p>but it throws an Exception with the following message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/local/lib/python3.5/dist-packages/telepot/__init__.py", line 738, in collector
      callback(item)
    File "testingStuff.py", line 150, in handle
      bot.editMessageText(messageEditID, "Does it work?")
    File "/usr/local/lib/python3.5/dist-packages/telepot/__init__.py", line 592, in editMessageText
      return self._api_request('editMessageText', _rectify(p))
    File "/usr/local/lib/python3.5/dist-packages/telepot/__init__.py", line 398, in _api_request
      return api.request((self._token, method, params, files), **kwargs)
    File "/usr/local/lib/python3.5/dist-packages/telepot/api.py", line 131, in request
      return _parse(r)
    File "/usr/local/lib/python3.5/dist-packages/telepot/api.py", line 126, in _parse
      raise exception.TelegramError(description, error_code, data)
  telepot.exception.TelegramError: ('Bad Request: Wrong inline message identifier specified', 400, {'description': 'Bad Request: Wrong inline message identifier specified', 'ok': False, 'error_code': 400})
  </code></pre>
  
  <p>It threw the same error when I tried to edit the message based on the response,</p>
  
  <pre><code>if msg['data'] == 'test':
      msgID = msg['message']['message_id']
      bot.editMessageText(msgID, "OBOY")
  </code></pre>
  
  <p>since the data for an incoming Inline Reply is:</p>
  
  <pre><code>{'chat_instance': '112564336693044113',
   'data': 'test',
   'from': {'first_name': 'B(', 'id': &lt;user ID&gt;, 'username': '&lt;username&gt;'},
   'id': '852908411206280027',
   'message': {'chat': {'id': &lt;chat ID&gt;,
                        'title': 'We da bes',
                        'type': 'supergroup',
                        'username': '&lt;chat username&gt;'},
               'date': 1477961765,
               'from': {'first_name': 'Testing For James',
                        'id': &lt;bot ID&gt;,
                        'username': '&lt;bot username&gt;'},
               'message_id': 63180,
               'text': 'Test'}}
  </code></pre>
  
  <p>Can anyone help me figure out where I've gone wrong?</p>