'Oliver Agency - Test', 'user_email' => 'webhook-test@oliver.agency' ]); echo "āœ… Webhook processor initialized\n"; // Test webhook connectivity first echo "šŸ”— Testing webhook connectivity...\n"; $connectivityTest = $webhookProcessor->testWebhook(); if ($connectivityTest['success']) { echo "āœ… Webhook endpoint is reachable\n"; echo " Response time: " . $connectivityTest['response_time_ms'] . "ms\n"; echo " HTTP code: " . $connectivityTest['http_code'] . "\n\n"; } else { echo "āŒ Webhook endpoint test failed\n"; echo " HTTP code: " . $connectivityTest['http_code'] . "\n"; echo " Error: " . $connectivityTest['error'] . "\n\n"; } // Create mock sound generation data $mockAudioData = createMockMp3Data(); $timestamp = date('Y-m-d_H-i-s'); $testWebhookData = [ 'prompt' => 'Test sound: Epic cinematic boom with reverb (WEBHOOK TEST)', 'generation_type' => 'ElevenLabs Sound Effects', 'settings' => [ 'prompt' => 'Test sound: Epic cinematic boom with reverb (WEBHOOK TEST)', 'duration_seconds' => 3.5, 'prompt_influence' => 0.7, 'model' => 'elevenlabs-sound-generation', 'test_mode' => true ], 'audio_data' => $mockAudioData, 'client' => 'Oliver Agency - Webhook Test', 'user_email' => 'webhook-test@oliver.agency', 'deliverable_number' => '1000000', 'additional_data' => [ 'filename' => 'test_sound_effect_' . $timestamp . '.mp3', 'file_size' => strlen($mockAudioData), 'generation_timestamp' => date('Y-m-d H:i:s'), 'api_endpoint' => 'elevenlabs-sound-generation', 'test_source' => 'webhook_test_script', 'test_description' => 'Mock sound generation for webhook testing' ] ]; echo "šŸ“¦ Prepared test webhook data:\n"; echo " Prompt: " . $testWebhookData['prompt'] . "\n"; echo " Duration: " . $testWebhookData['settings']['duration_seconds'] . " seconds\n"; echo " Prompt Influence: " . $testWebhookData['settings']['prompt_influence'] . "\n"; echo " Audio Data Size: " . strlen($mockAudioData) . " bytes\n"; echo " Deliverable Number: " . $testWebhookData['deliverable_number'] . "\n\n"; // Send the webhook echo "šŸš€ Sending test webhook...\n"; $webhookSuccess = $webhookProcessor->sendGenerationData($testWebhookData); if ($webhookSuccess) { echo "āœ… Test webhook sent successfully!\n"; echo " Data should now be visible in your webhook automation system\n"; echo " Look for deliverable: " . $testWebhookData['deliverable_number'] . "\n"; } else { echo "āŒ Test webhook failed to send\n"; echo " Check error logs for more details\n"; } echo "\nšŸ“Š Webhook Configuration:\n"; $config = $webhookProcessor->getConfig(); foreach ($config as $key => $value) { if (is_array($value)) { echo " $key: " . json_encode($value) . "\n"; } else { echo " $key: $value\n"; } } } catch (Exception $e) { echo "āŒ Test failed with exception: " . $e->getMessage() . "\n"; echo " Stack trace: " . $e->getTraceAsString() . "\n"; } echo "\nšŸ” Next Steps:\n"; echo "1. Check your webhook automation system for the test data\n"; echo "2. Look for deliverable number starting with 'TEST-'\n"; echo "3. Verify all fields are received correctly\n"; echo "4. Check that the audio file (base64 encoded MP3) is properly formatted\n"; echo "\nTest completed at: " . date('Y-m-d H:i:s') . "\n"; ?>