I set up an AWS Lambda webhook to a Telegram bot. Regular messages are passed to event properly, but when a user uploads an image only 'text is passed to event. What could be the problem?
Screenshot of the received data.
def hello(event, context):
try:
data = json.loads(event["body"])
originalBody = str(data)
message = str(data["message"]["text"])
chat_id = data["message"]["chat"]["id"]
first_name = data["message"]["chat"]["first_name"]
print(data)
response = "Please /start, {}".format(first_name)
if "start" in message:
response = "Hello {}".format(first_name)
#data = {"text": response.encode("utf8"), "chat_id": chat_id}
data = {"text": "heyyyy!", "chat_id": chat_id}
url = BASE_URL + "/sendMessage"
requests.post(url, data)
requests.post(url, originalBody)
except Exception as e:
print(e)
return {"statusCode": 200}