<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: DICKY GAMING</title>
    <description>The latest articles on DEV Community by DICKY GAMING (@dicky_gaming_b4e3f44b4458).</description>
    <link>https://dev.to/dicky_gaming_b4e3f44b4458</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4024688%2F09fb424b-85c4-4478-a8c7-79a6b912c421.jpg</url>
      <title>DEV Community: DICKY GAMING</title>
      <link>https://dev.to/dicky_gaming_b4e3f44b4458</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dicky_gaming_b4e3f44b4458"/>
    <language>en</language>
    <item>
      <title>GoalPulse AI: The Ultra-Passionate World Cup WhatsApp Companion Built with PHP &amp; Google AI</title>
      <dc:creator>DICKY GAMING</dc:creator>
      <pubDate>Sat, 11 Jul 2026 04:24:58 +0000</pubDate>
      <link>https://dev.to/dicky_gaming_b4e3f44b4458/goalpulse-ai-the-ultra-passionate-world-cup-whatsapp-companion-built-with-php-google-ai-33fh</link>
      <guid>https://dev.to/dicky_gaming_b4e3f44b4458/goalpulse-ai-the-ultra-passionate-world-cup-whatsapp-companion-built-with-php-google-ai-33fh</guid>
      <description>&lt;p&gt;This is a submission for the DEV Weekend Challenge: Passion Edition&lt;/p&gt;

&lt;p&gt;What I Built&lt;br&gt;
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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Demo&lt;br&gt;
Imagine texting your bot during a tense penalty shootout. Here is how GoalPulse AI responds in real-time on WhatsApp:&lt;/p&gt;

&lt;p&gt;Fan: "I can't believe we just missed that penalty in the 89th minute! My heart is broken!"&lt;br&gt;
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! 🔥⚽💪"&lt;/p&gt;

&lt;p&gt;(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!)&lt;/p&gt;

&lt;p&gt;Code&lt;br&gt;
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.&lt;/p&gt;

&lt;p&gt;Here is the lightweight PHP integration that supercharges incoming WhatsApp leads with Google AI:&lt;/p&gt;

&lt;p&gt;PHP&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class="cd"&gt;/**
 * GoalPulse AI - Passionate Football Companion
 * Integrates WhatsApp Webhook with Google AI (Gemini API)
 */&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;getPassionateCommentary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$userMessage&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$favoriteTeam&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Global Football"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$apiKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'YOUR_GOOGLE_AI_API_KEY'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key="&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$apiKey&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

    &lt;span class="nv"&gt;$payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"contents"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="p"&gt;[&lt;/span&gt;
                &lt;span class="s2"&gt;"parts"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
                    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"text"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$systemPrompt&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="s2"&gt;User Message: "&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$userMessage&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                &lt;span class="p"&gt;]&lt;/span&gt;
            &lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="p"&gt;],&lt;/span&gt;
        &lt;span class="s2"&gt;"generationConfig"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="s2"&gt;"temperature"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// High temperature for creative, emotional responses&lt;/span&gt;
            &lt;span class="s2"&gt;"maxOutputTokens"&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="nv"&gt;$ch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;curl_init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_RETURNTRANSFER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_POST&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_POSTFIELDS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;json_encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$payload&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="nb"&gt;curl_setopt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLOPT_HTTPHEADER&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt;
    &lt;span class="p"&gt;]);&lt;/span&gt;

    &lt;span class="nv"&gt;$response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;curl_exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nv"&gt;$httpCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;curl_getinfo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CURLINFO_HTTP_CODE&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;curl_close&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ch&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$httpCode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;json_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'candidates'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'content'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'parts'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;'text'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s2"&gt;"THE STADIUM IS ROARING! WHAT A GAME! ⚽🔥"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nb"&gt;error_log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Google AI API Error: "&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;"The pitch is super intense right now! Send your message again in a second! ⚽💪"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Example Webhook Processing Loop&lt;/span&gt;
&lt;span class="nv"&gt;$incomingText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Why is our midfield collapsing against their high press?!"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$replyText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;getPassionateCommentary&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$incomingText&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Brazil"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Route $replyText back to WhatsApp using cURL and Meta Graph API...&lt;/span&gt;
&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"AI Response Generated:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$replyText&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cp"&gt;?&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How I Built It&lt;br&gt;
Building this required solving three key challenges to make the automation feel alive rather than robotic:&lt;/p&gt;

&lt;p&gt;Webhook Security &amp;amp; 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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;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.&lt;/p&gt;

&lt;p&gt;Prize Categories&lt;br&gt;
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.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>weekendchallenge</category>
      <category>googleaichallenge</category>
      <category>php</category>
    </item>
  </channel>
</rss>
