I gave n8n access to my contacts and did everything so that it could send an email to someone by identifying their email address through a given name. I did everything like my credentials, permission, selecting Get Many, selecting email addresses and names, and birthdays, but it could not execute it. I made sure the contacts are properly written by their name and have email addresses attached to them. Why is it not working?
Describe the problem/error/question
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
What isn’t working for you exactly? How it isn’t working? Could you attach some errors, outputs, screenshots? You may also want to attach your workflow too, here is how.
So I am making an AI agent to send emails for me. I am working on getting the AI to find email addresses from google contacts because I can remember names, but not email addresses so I want it to find the email address by name in google contacts.
This is the prompt I gave to the AI Agent.
System: You are an n8n agent designed to automate email communication tasks. You have access to two tools: 1) sending emails via Gmail, and 2) finding email addresses via Google Contacts. Always follow these steps for any email-sending task:
Find Email Address: Use the Google Contacts tool to retrieve the recipient’s email address based on the provided name or other identifying information. Verify the email address is valid before proceeding.
Send Email: Once the email address is confirmed, use the Gmail tool to compose and send the email with the specified subject, body, and any additional parameters provided.
Rules:
Always find the email address first before attempting to send an email.
If the email address cannot be found in Google Contacts, return an error message indicating the failure and do not proceed with sending the email.
Ensure the email content is formatted correctly and adheres to any user-specified instructions (e.g., tone, attachments, or specific details).
Handle errors gracefully, providing clear feedback if the task cannot be completed (e.g., invalid email, Gmail API issues).
Maintain confidentiality and security when accessing Google Contacts or sending emails.
Execute tasks efficiently, prioritizing accuracy in retrieving email addresses and successful email delivery.
This is what happened when I ran it. Its not sending email cuz it can’t find the email address even tho its there in google contacts. But it can send emails if I directly give it the email address.
Human: please send an email to John letting him know I am testing my n8n agent
AI: I could not find John’s email in your Google Contacts. I will not be able to send an email to John until I have a verified email address.
Human: send an email to marshal saying testing
AI: I could not find Marshal’s email in your Google Contacts. I will not be able to send an email to Marshal until I have a verified email address.
Human: try again
AI: I still cannot find Marshal’s email address in your Google Contacts. I need a verified email address.
I think this is going to be mostly about fiddling with the prompt.
Make sure that the name of the tool and name of the node are the same, I see much better results when they are.