Dooratre commited on
Commit
6a9fa87
·
verified ·
1 Parent(s): 7d5d6e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ app = Flask(__name__)
8
  # Load page credentials from token.json
9
  try:
10
  with open('token.json', 'r') as f:
11
- PAGE_CREDENTIALS = {page['app_id']: page['page_token'] for page in json.load(f)['pages']}
12
  except FileNotFoundError:
13
  print("Error: 'token.json' file not found. Please create it and add page credentials.")
14
  PAGE_CREDENTIALS = {}
@@ -32,7 +32,7 @@ def handle_message():
32
  body = request.get_json()
33
 
34
  for entry in body["entry"]:
35
- page_id = entry["id"]
36
  page_token = PAGE_CREDENTIALS.get(page_id)
37
 
38
  if not page_token:
 
8
  # Load page credentials from token.json
9
  try:
10
  with open('token.json', 'r') as f:
11
+ PAGE_CREDENTIALS = {page['page_id']: page['page_token'] for page in json.load(f)['pages']}
12
  except FileNotFoundError:
13
  print("Error: 'token.json' file not found. Please create it and add page credentials.")
14
  PAGE_CREDENTIALS = {}
 
32
  body = request.get_json()
33
 
34
  for entry in body["entry"]:
35
+ page_id = entry["id"] # Extract page_id from the incoming message
36
  page_token = PAGE_CREDENTIALS.get(page_id)
37
 
38
  if not page_token: