cat
02/06/2025, 6:42 AMVapi
02/06/2025, 6:42 AMVapi
02/06/2025, 6:43 AMcat
02/06/2025, 6:43 AMVapi
02/06/2025, 6:43 AMpython
from flask import Flask, request, jsonify
import logging
app = Flask(__name__)
logging.basicConfig(level=logging.INFO)
@app.route('/webhook', methods=['POST'])
def webhook():
try:
data = request.json
logging.info(f"Received webhook: {data}")
# Extract the desired information from the VAPI structure
call_id = data.get('callId')
status = data.get('status')
# Add more fields as needed
# Process the extracted information as needed
# ...
return jsonify({"message": "Webhook received successfully"}), 200
except Exception as e:
logging.error(f"Error handling webhook: {str(e)}")
return jsonify({"error": str(e)}), 500
if __name__ == '__main__':
app.run(debug=True)
In this script, when the /webhook endpoint receives a POST request, it logs the incoming data and extracts the callId and status fields from the JSON payload. You can add more fields to extract as needed.
Make sure to replace the placeholder fields and add any additional processing you require for your specific use case. If you have any specific questions or need further assistance with your script, feel free to ask!cat
02/06/2025, 6:44 AMcat
02/06/2025, 6:44 AMVapi
02/06/2025, 6:44 AMcat
02/06/2025, 6:45 AMVapi
02/06/2025, 6:45 AM