Looping old messages ( I am Building a chatbot for Whatsapp)
skshadan opened this issue · 2 comments
if i re deploy the bot on heruku, it's looping through the old messages and spamming.
PLS HELP TO FIX IT!'
if request.method == 'POST':
body = request.getjson()
print(body)
if body.get("object") and body.get("entry") and body["entry"][0].get("changes") and
body["entry"][0]["changes"][0].get("value").get("messages"):
from = body["entry"][0]["changes"][0]["value"]["messages"][0]["from"]
msg_id = body["entry"][0]["changes"][0]["value"]["messages"][0]["id"]
datetime_str = body["entry"][0]["changes"][0]["value"]["messages"][0]["timestamp"]
msgbody = body["entry"][0]["changes"][0]["value"]["messages"][0].get("text", {}).get("body", "")
name = body["entry"][0]["changes"][0]["value"]["contacts"][0]["profile"]["name"]
Hi @shadaenx
Can you provide more context about the scenario, Like the snippet of webhook you're running and if there are errors being raised causing the messages to be resent?
I've the same issue.