Complete the code to define the HTTP method for the webhook registration endpoint.
app.route('/webhook/register', methods=[[1]]) def register_webhook(): return 'Webhook registered', 200
The webhook registration endpoint should use the POST method to accept registration data.
Complete the code to extract the webhook URL from the JSON request body.
data = request.get_json()
webhook_url = data[1]The webhook URL is expected to be under the key "url" in the JSON data.
Fix the error in the code to validate the webhook URL format.
if not webhook_url.startswith([1]): return 'Invalid URL', 400
Webhook URLs should start with "https://" for secure communication.
Fill both blanks to store the webhook URL and respond with success.
registered_webhooks.append([1]) return [2], 201
The webhook URL is added to the list, and a success message is returned with status 201.
Fill all three blanks to complete the webhook registration function with error handling.
def register_webhook(): data = request.get_json() webhook_url = data[1] if not webhook_url.startswith([2]): return 'Invalid URL', 400 registered_webhooks.append([3]) return 'Webhook registered', 201
The function extracts the URL from the key "url", checks it starts with "https://", appends it to the list, and returns success.