How It Works
The Gmail Add-on is a Google Apps Script that adds a sidebar to Gmail. When you receive an enquiry, open the email and click the QuotePilot icon in the sidebar — it shows your qualification questions and lets you send them with one click, logging the prospect directly into this app.
No Google Marketplace approval needed — you deploy it as a personal add-on in under 5 minutes.
Setup Steps
1
Go to script.google.com and create a new project. Name it "QuotePilot".
2
Delete the default code and paste in the Apps Script code from the box on the right.
3
Update
QUOTEPILOT_URL and API_KEY at the top of the script. 4
Click Deploy → Test deployments → Install add-on for yourself.
5
Open Gmail, find a new enquiry email, and look for the QuotePilot icon in the right sidebar.
Your API Details
Click each field to select and copy into the Apps Script.
Apps Script Code
// QuotePilot Gmail Add-on
// Paste this entire file into your Apps Script project
const QUOTEPILOT_URL = 'https://quotepilot.kewl-site.net/api/prospect.php';
const API_KEY = 'qpiliot';
const QUESTIONS = [
"What\'s the main problem you\'re trying to solve with this project?",
"Do you have a budget range in mind? (rough ballpark is fine)",
"What\'s your ideal timeline for getting this live?",
"Have you worked with a developer on something like this before?",
"Who else is involved in the decision — just you, or others?",
"Is there an existing system this needs to integrate with or replace?",
];
function onGmailMessage(e) {
const accessor = e.gmail.accessToken
? GmailApp.getMessageById(e.gmail.messageId)
: null;
const senderName = accessor ? accessor.getFrom().replace(/<.*>/, '').trim() : '';
const senderEmail = accessor ? accessor.getFrom().match(/<(.+)>/)?.[1] || accessor.getFrom() : '';
const card = CardService.newCardBuilder()
.setHeader(CardService.newCardHeader()
.setTitle('QuotePilot')
.setSubtitle('Qualification Questions'))
.addSection(buildQuestionsSection(senderName, senderEmail))
.build();
return [card];
}
function buildQuestionsSection(name, email) {
const section = CardService.newCardSection()
.setHeader('Send to: ' + (name || email || 'this sender'));
const body = QUESTIONS.map((q, i) => (i + 1) + '. ' + q).join('\n\n');
section.addWidget(
CardService.newTextParagraph().setText(body)
);
section.addWidget(
CardService.newButtonSet().addButton(
CardService.newTextButton()
.setText('Send Questions')
.setOnClickAction(
CardService.newAction()
.setFunctionName('sendQuestions')
.setParameters({ name, email })
)
)
);
return section;
}
function sendQuestions(e) {
const { name, email } = e.parameters;
if (!email) {
return CardService.newActionResponseBuilder()
.setNotification(CardService.newNotification()
.setText('Could not detect sender email.'))
.build();
}
// Draft the email
const subject = 'Re: Your enquiry';
const body = "Hi " + (name.split(' ')[0] || 'there') + ",\n\n"
+ "Thanks for reaching out! To make sure I can put together the most accurate quote for you, "
+ "could you help me with a few quick questions?\n\n"
+ QUESTIONS.map((q, i) => (i + 1) + '. ' + q).join('\n\n')
+ "\n\nTakes 2 minutes and means my quote will be spot-on for your needs.\n\nThanks,\n[Your name]";
GmailApp.createDraft(email, subject, body);
// Log prospect in QuotePilot
try {
UrlFetchApp.fetch(QUOTEPILOT_URL, {
method: 'post',
contentType: 'application/json',
payload: JSON.stringify({ name, email, source: 'gmail', api_key: API_KEY }),
muteHttpExceptions: true,
});
} catch(err) {
// silently fail — draft still created
}
return CardService.newActionResponseBuilder()
.setNotification(CardService.newNotification()
.setText('Draft created and prospect logged!'))
.build();
}
Qualification Questions
These are embedded in the Apps Script above. To change them, edit the script.
01
What's the main problem you're trying to solve with this project?
02
Do you have a budget range in mind? (rough ballpark is fine)
03
What's your ideal timeline for getting this live?
04
Have you worked with a developer on something like this before?
05
Who else is involved in the decision — just you, or others?
06
Is there an existing system this needs to integrate with or replace?