cd /news/artificial-intelligence/goalpulse-ai-the-ultra-passionate-wo… · home topics artificial-intelligence article
[ARTICLE · art-55157] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

GoalPulse AI: The Ultra-Passionate World Cup WhatsApp Companion Built with PHP & Google AI

A developer built GoalPulse AI, an automated WhatsApp football companion using PHP, Meta Graph API, and Google AI (Gemini). The bot generates passionate, emotionally charged responses to live match updates, acting as a die-hard commentator and tactical analyst. The system integrates a PHP webhook validator, state-machine router, and Gemini API to deliver high-energy replies.

read4 min views1 publishedJul 11, 2026

This is a submission for the DEV Weekend Challenge: Passion Edition

What I Built

Football (or soccer) isn’t just a game—it’s an all-consuming passion, a global heartbeat, and sometimes, a rollercoaster of heartbreak and ecstasy. With the World Cup fervor taking over stadiums, living rooms, and streets worldwide, fans need a space to channel their adrenaline.

I built GoalPulse AI, an automated WhatsApp football companion powered by PHP, Meta Graph API, and Google AI (Gemini). Instead of a robotic, dry auto-responder, GoalPulse AI acts as a die-hard, ultra-passionate match commentator and tactical analyst right in your WhatsApp chat.

Whenever a fan texts a live match update, expresses frustration over a missed penalty, or asks for tactical insights, GoalPulse AI dynamically generates high-energy, emotionally charged responses that match the intense spirit of the tournament.

Demo

Imagine texting your bot during a tense penalty shootout. Here is how GoalPulse AI responds in real-time on WhatsApp:

Fan: "I can't believe we just missed that penalty in the 89th minute! My heart is broken!"

GoalPulse AI ⚽🔥: "ARE YOU KIDDING ME?! THAT WAS THE MOMENT! 😭💔 To hit the crossbar in the 89th minute when glory was staring us right in the face?! But listen to me—WE DO NOT DROP OUR HEADS! This is the World Cup! We still have extra time! Keep believing, scream louder from the living room, and let's push the boys over the line! WHAT A MATCH! 🔥⚽💪"

(Since this is a backend Webhook system, the magic happens silently on the server, transforming raw incoming webhooks into passionate AI-generated broadcasts in milliseconds!)

Code

The core of this system merges a PHP Webhook signature validator, a state-machine router, and the Google Gemini API to inject raw human passion into automated replies.

Here is the lightweight PHP integration that supercharges incoming WhatsApp leads with Google AI:

PHP

<?php
/**
 * GoalPulse AI - Passionate Football Companion
 * Integrates WhatsApp Webhook with Google AI (Gemini API)
 */

function getPassionateCommentary($userMessage, $favoriteTeam = "Global Football") {
    $apiKey = 'YOUR_GOOGLE_AI_API_KEY';
    $url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=" . $apiKey;

    // Crafting a system persona driven entirely by passion
    $systemPrompt = "You are GoalPulse AI, an ultra-passionate, die-hard football/soccer commentator and analyst on WhatsApp. "
                  . "The user is talking about the World Cup or their favorite team ($favoriteTeam). "
                  . "Respond with EXTREME passion, emotional intensity, football tactical knowledge, and stadium excitement! "
                  . "Use emojis (🔥, ⚽, 😭, 💪, 🏆), keep it under 3 short paragraphs suitable for WhatsApp reading, "
                  . "and match the user's emotional state (celebrating a goal, mourning a loss, or analyzing tactics).";

    $payload = [
        "contents" => [
            [
                "parts" => [
                    ["text" => $systemPrompt . "\n\nUser Message: " . $userMessage]
                ]
            ]
        ],
        "generationConfig" => [
            "temperature" => 0.9, // High temperature for creative, emotional responses
            "maxOutputTokens" => 250
        ]
    ];

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json'
    ]);

    $response = curl_exec($ch);
    $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($httpCode == 200 && $response) {
        $data = json_decode($response, true);
        return $data['candidates'][0]['content']['parts'][0]['text'] ?? "THE STADIUM IS ROARING! WHAT A GAME! ⚽🔥";
    }

    error_log("Google AI API Error: " . $response);
    return "The pitch is super intense right now! Send your message again in a second! ⚽💪";
}

// Example Webhook Processing Loop
$incomingText = "Why is our midfield collapsing against their high press?!";
$replyText = getPassionateCommentary($incomingText, "Brazil");

// Route $replyText back to WhatsApp using cURL and Meta Graph API...
echo "AI Response Generated:\n" . $replyText;
?>

How I Built It

Building this required solving three key challenges to make the automation feel alive rather than robotic:

Webhook Security & Routing: I utilized pure PHP with HMAC SHA-256 signature validation (X-Hub-Signature-256) to ensure that every incoming payload genuinely originates from Meta's servers before processing.

Injecting Passion via Google AI: Standard chatbots fail at sports because they sound too analytical. By tweaking the temperature parameter to 0.9 in the Google Gemini API and structuring a persona-driven system prompt, the AI transforms dry tactical questions into electrifying, living-room-stadium commentary.

Resilient Broadcasting: During major World Cup moments, message volume spikes. I wrapped the outgoing cURL requests in an exponential backoff algorithm to gracefully handle WhatsApp API rate limits (HTTP 429) without dropping a single celebratory message.

Prize Categories

Best Use of Google AI — This project heavily relies on the Google Gemini API (gemini-1.5-flash) to interpret natural language emotional triggers from sports fans and dynamically generate context-aware, highly passionate football commentary in real-time.

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @goalpulse ai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/goalpulse-ai-the-ult…] indexed:0 read:4min 2026-07-11 ·