John Landry commited on
Commit
33134c0
1 Parent(s): c4e7ed8
Files changed (1) hide show
  1. main.py +2 -4
main.py CHANGED
@@ -32,17 +32,15 @@ async def verify(
32
 
33
  @app.post("/webook")
34
  async def callback(request: Request):
35
- print("============ callback is being called ============")
36
  body = await request.body()
37
- print(body)
38
  data = json.loads(body)
39
  value = data['entry'][0]['changes'][0]['value']
40
- print("VALUE: " + str(value))
41
 
42
- if 'messages' in value:
43
  message = value['messages'][0]
44
  phone_num = message['from']
45
  mesg_body = value['messages'][0]['text']['body']
 
46
  documents = vectorstore.similarity_search(mesg_body)
47
  print(f"DOCUMENT: {len(documents)}")
48
  client = WhatsAppWrapper()
 
32
 
33
  @app.post("/webook")
34
  async def callback(request: Request):
 
35
  body = await request.body()
 
36
  data = json.loads(body)
37
  value = data['entry'][0]['changes'][0]['value']
 
38
 
39
+ if 'messages' in value and 'from ' in value['messages'][0] and 'text' in value['messages'][0]:
40
  message = value['messages'][0]
41
  phone_num = message['from']
42
  mesg_body = value['messages'][0]['text']['body']
43
+ print("SEARCH: " + str(mesg_body))
44
  documents = vectorstore.similarity_search(mesg_body)
45
  print(f"DOCUMENT: {len(documents)}")
46
  client = WhatsAppWrapper()