codeOpenAI

Here is an easy integration flow to start using OpenAI with the SimpleSpa API

Flow

SimpleSpa API (/clients.php)
        โ†“
Filter Clients (birthday month = this month)
        โ†“
For Each Client:
    โ†“
    โ†’ Create custom prompt (Name + Birthday)
    โ†’ Send to OpenAI (ChatGPT API)
    โ†’ Receive Birthday Message
    โ†’ (Optional) Send email via Mailchimp/Gmail

React

npm create vite@latest birthday-ai-app -- --template react
cd birthday-ai-app
npm install axios
npm run dev

Then replace src/App.jsx with this:

What This React App Does:

Step

Action

1

Calls your SimpleSpa API to get todayโ€™s birthday clients

2

For each client, calls OpenAI and generates a unique message

3

Displays the generated birthday messages on the screen

PHP

To do this directly on your webserver you can also create a PHP file that generates this message

Last updated