Skip to content

Commit

Permalink
Restore unresolved FIXME markers
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Dec 13, 2023
1 parent c30a9c8 commit f58932d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions funnel/views/api/whatsapp_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@


@app.route('/api/1/whatsapp/meta_event', methods=['GET'])
def process_whatsapp_webhook_verification():
"""Meta requires to verify the webhook URL by sending a GET request with a token."""
def process_whatsapp_webhook_verification() -> ReturnView:
"""Meta verifies the webhook URL by sending a GET request with a token."""
# FIXME: This looks half baked. What is the "challenge" being returned?
verify_token = app.config['WHATSAPP_WEBHOOK_SECRET']
mode = request.args.get('hub.mode')
token = request.args.get('hub.verify_token')
challenge = request.args.get('hub.challenge')
mode = request.args['hub.mode']
token = request.args['hub.verify_token']
challenge = request.args['hub.challenge']

if mode and token:
if mode == 'subscribe' and token == verify_token:
Expand All @@ -32,6 +33,8 @@ def process_whatsapp_event() -> ReturnView:
"""Process WhatsApp callback event from Meta Cloud API."""
# Register the fact that we got a WhatsApp event.
# If there are too many rejects, then most likely a hack attempt.

# FIXME: Where is the call verification?
statsd.incr(
'phone_number.event', tags={'engine': 'whatsapp-meta', 'stage': 'received'}
)
Expand Down

0 comments on commit f58932d

Please sign in to comment.