Create an Email Blasting GPT in 15 minutes
We've gone "all in" on GPTs for obvious reasons. Magic and Hyperlambda allows us to create super rich functionality and integrate with custom GPTs to an extent impossible to believe in before you see it.
In the following video I am basically creating an AI-based email blaster, allowing me to collect emails, and also send emails, using ChatGPT as my user interface, having ChatGPT help me write my emails. The whole thing is facilitated for using the newly released GPT feature from OpenAI, and combining it with Magic and Hyperlambda.
The video is fairly self explanatory in regards to how I create my SQL database and my CRUD endpoints to store my contacts, but the code for my "send-email" endpoint needs to be shown. Assuming you've configured your cloudlet's SMTP server settings, you can simply copy and paste the following code into a file called "send-email.post.hl", and you're basically done.
// Arguments collection declaring what arguments the endpoint accepts.
.arguments
name:string
email:string
subject:string
body:string
.description:Sends an email to the specified recipient with the specified subject and body
// Changing recipients name/email.
set-value:x:./*/mail.smtp.send/**/rec
get-value:x:@.arguments/*/email
set-name:x:./*/mail.smtp.send/**/rec
get-value:x:@.arguments/*/name
// Sending email.
unwrap:x:+/**
mail.smtp.send
message
to
rec:john@doe.com
subject:x:@.arguments/*/subject
entity:text/plain
content:x:@.arguments/*/body
return
result:success
Watch the video above to understand how to create and interact with the GPT you just created. Below are some example prompts you can use to interact with your GPT once you're done creating it.
- Create a new contact named John Doe with email being john@doe.com
- Help me create an email with a great recipe for pancakes with a catching subject and body and send it to John Doe
Have a Custom AI Solution
At AINIRO we specialise in delivering custom AI solutions and AI chatbots. If you want to talk to us about how we can help you implement your next custom AI solution, you can reach out to us below.