top of page

From Automation to Agent: How to Upgrade Your Birthday Notifier with AI Gift Suggestions

  • sheharav
  • 2 days ago
  • 3 min read

If you followed my last guide, you now have a fantastic automated system: the AI-Powered Birthday Notification System. It runs daily, checks your spreadsheet, and generates a personalized birthday message using the Gemini API.


But why stop at automation? We can transform this passive reporter into a simple AI Agent that solves the next most common problem: What gift should I buy?


By giving the system a second, complex task, generating thoughtful gift recommendations based on the person's interests we dramatically increase its value and push it into agent territory.


Here is your complete guide to upgrading to a more powerful assistant.


The Upgrade: From Reporter to Assistant

In the world of AI, an Agent is defined by its ability to take action and make intelligent, contextual decisions.


  • Original System (Automation): Reports an event (birthday) and executes a message generation task.

  • New System (Agent): Reports the event, executes the message generation, and proactively solves the gift problem by executing a separate, structured recommendation task using the context in your spreadsheet.


Phase 1: Code Integration (The New Logic)

We will modify your existing Code.gs file in Google Apps Script. This update adds a new function (generateGiftSuggestions) and updates the main scheduler to call both the message and the gift function simultaneously.


Step 1: Replace Your Existing Code

  1. Open your Google Sheet and go to Extensions > Apps Script.

  2. In the Code.gs file, delete all the existing code and replace it with the complete, updated script:



This new script handles two separate API calls and cleanly formats both the message and the gift suggestions in your final email.


Important: Remember to verify that the RECIPIENT_EMAIL is set to your address at the top of the script!

$$Insert the complete `birthday-notifier-agent.js` file content here$$


Phase 2: Data Check and Function Breakdown

The gift suggestion feature relies entirely on one specific column in your sheet:

Data Check: The Importance of "Notes/Context"

Ensure your Notes/Context column (Column E) is filled out


Column E

Gift Suggestion Output

Loves gardening and has a pet cat named Miso.

Suggestions for unique gardening tools and personalized cat-themed items.

Recently started a new job in finance.

Suggestions for professional desk gadgets, high-quality coffee gear, or finance-themed books.

 

How the New Functions Work:

  1. sendBirthdayReminders() (Updated): This function now checks the person's classification. All classifications (1-5) receive an AI message. Crucially, the gift suggestion is restricted only to classifications 1 (Close Family) and 3 (Close Friends) to optimize API usage and focus your efforts.

  2. generateGiftSuggestions() (New Agent Logic):

    • It uses a specialized system prompt: "You are an expert gift advisor. Provide three unique and thoughtful gift ideas..."

    • It uses a slightly lower temperature setting (0.7 vs 0.8) to ensure the ideas are more practical and less abstract than the creative birthday message.

    • Classification Control: This function is only called for the most important categories (1 and 3). Classifications 2 (Extended Family) and 4 (Friends) will receive the message but no gift suggestion, while Classification 5 (Deceased) receives only the reflective message.


Phase 3: Final Launch

Since you have already completed the initial setup (getting the API key, setting script properties, and authorizing permissions), you don't need to repeat those steps.


Step 2: Test the Agent

  1. In your Google Sheet, ensure there is a person whose birthday is today, and set their Last Sent Year (Column D) to a past year (e.g., 2024).

  2. In the Apps Script editor, select the function sendBirthdayReminders.

  3. Click the Run button (triangle icon).

  4. Check your email. You should now see the personalized message followed by the new Gift Suggestions section!


Step 3: Verify the Trigger

The daily scheduled trigger (createDailyTrigger) you set up previously is still active and will continue to run this newly updated, agentic code every morning, automatically providing you with unique messages and gift ideas.


You will find the full guide here:


Congratulations! Your Birthday Agent is now an intelligent, proactive assistant, tackling multiple related tasks with contextual awareness.



Comments


bottom of page