2025-04-20 01:40:40 -03:00
PARAM to AS STRING
PARAM template AS STRING
PARAM opportunity AS STRING
company = QUERY "SELECT Company FROM Opportunities WHERE Id = ${opportunity}"
doc = FILL template
2025-07-02 14:22:11 -03:00
' Generate email subject and content based on conversation history
2025-04-20 01:40:40 -03:00
subject = REWRITE "Based on this ${history}, generate a subject for a proposal email to ${company}"
contents = REWRITE "Based on this ${history}, and ${subject}, generate the e-mail body for ${to}, signed by ${user}, including key points from our proposal"
2025-07-02 14:22:11 -03:00
' Add proposal to CRM
2025-04-20 01:40:40 -03:00
CALL "/files/upload" , ".gbdrive/Proposals/${company}-proposal.docx" , doc
CALL "/files/permissions" , ".gbdrive/Proposals/${company}-proposal.docx" , "sales-team" , "edit"
2025-07-02 14:22:11 -03:00
' Record activity in CRM
2025-04-20 01:40:40 -03:00
CALL "/crm/activities/create" , opportunity , "email_sent" , {
"subject" : subject ,
"description" : "Proposal sent to " + company ,
"date" : NOW ( )
}
2025-07-02 14:22:11 -03:00
' Send the email
2025-04-20 01:40:40 -03:00
CALL "/comm/email/send" , to , subject , contents , doc