Free script to send record values to mandrill email templates.

  • 1
  • 1
  • Question
  • Updated 11 months ago
  • Doesn't Need an Answer
  • (Edited)
A scalable script to send values from a record to a mandrill(mailchimp) email template.
https://gist.github.com/chucksupport/56733f7671bcec0429d11e50061fc0ec#file-qbtomandrill


Instructions:
Requirement: IOL technique.
Requirement: Mandrill API key and QB apptoken

Configuration:
In the script you'll see an object like this. copy the object jobSheet or bookingTicket or rename them. For the fields you enter the exact name (no spaces) of your merge tag *|MERGE_TAG|* and the quickbase field ID of the field you want pushed to that tag in your email. More comments in the code below and in the script. If you need any help you can reach out directly
earn.com/chuck

fields:{MERGE_TAG:"123"}

var template = {


    jobSheet: {
        timestampField:"_fid_342", //the field on the form you want to timestamp when the email was sent.
        fields: {
            enterMailchimpMergeTagName: "123" //the id of the quickbase field
        },
        msgObj: {
            "template_name": "templateName" // the slug of the mailchimp template
            "template_content": [{
                "name": "Job Sheet",
                "content": "Job Sheet Information"
            }],
            "message": {
                "from_email": "FROM EMAIL",
                "to": "",
                "subject": "job sheet for ",
                "text": "Find your job sheet information below.",
                "merge": true,
                "global_merge_vars": [],
                "merge_vars": ""
            }
        }
    },

    bookingTicket: {
        timestampField:"_fid_341",
        fields: {
           

        },
        msgObj: {
            "template_name": "bookingticket",
            "template_content": [{
                "name": "Booking Ticket",
                "content": "Booking Ticket Information"
            }],
            "message": {
                "from_email": "FROM EMAIL",
                "to": "",
                "subject": "booking ticket for ",
                "text": "Find your booking ticket information below.",
                "merge": true,
                "global_merge_vars": [],
                "merge_vars": ""
            }
        }
    }
}



After its all setup then you would add a couple buttons on your form that trigger the mail().

in this example i want to send jobsheet so the button would have javascript:mail(template.jobSheet); return false;

again happy to answer any questions or if ya need assistance implementing it. Earn.com/chuck
Photo of Chuck Grigsby

Chuck Grigsby

  • 1,978 Points 1k badge 2x thumb

Posted 12 months ago

  • 1
  • 1
Photo of Gaurav Sharma

Gaurav Sharma

  • 5,756 Points 5k badge 2x thumb
Thanks for sharing this with the community. :)

Cheers,

Gaurav
Photo of Kelly

Kelly

  • 1,762 Points 1k badge 2x thumb
Can this be done through webhooks?
Photo of Chuck Grigsby

Chuck Grigsby

  • 1,958 Points 1k badge 2x thumb
I'm just using APIs for mandrill and QB. I'm sure it's possible but may be easier to just use this. Welcome to contact me if ya have questions. Earn.com/chuck