Learning Timeline
Key Insights
Tokens & Context Window Tips
Ensure attachment files are in text or simple PDF format. If a file is too large, Gemini may 'hallucinate' or fail to process the entire dataset in a single API call.
API Key Security
Never expose your API Key openly in your code. Use 'Script Properties' under 'Project Settings' in Apps Script to store your API Key securely.
Prompts
Automated Video Script Writing Prompt
Target:
Gemini
You are a professional content creator. Based on the information provided in this attachment: [Insert Data], write a 60-second viral TikTok script. Include a compelling hook, 3 main value points, and a clear Call to Action (CTA). Tone should be conversational and engaging.
Step by Step
How to Set Up Email-to-Script Automation with Gemini
- Open Google Drive and create a specific folder named 'Content Automation'.
- Open Google Apps Script (script.google.com) and create a new project.
- Enable 'Gmail API' and 'Google Docs API' under the 'Services' section on the left sidebar.
- Write a trigger function using 'GmailApp.search' to detect emails with a specific subject (e.g., 'REQUEST SKRIP').
- Use the 'message.getAttachments()' command to retrieve reference files from the email.
- Make a fetch call to the Gemini API, passing the retrieved file information into the prompt.
- Instruct Gemini to generate a script draft based on that data.
- Use 'DocumentApp.create()' to automatically create a new Google Doc containing the Gemini output.
- Set a 'Time-driven trigger' in the 'Triggers' section (clock icon) to run the script automatically every 5 or 10 minutes.