FileMaker Integration with Mandrill

Revolution11 has had great success incorporating Mandrill, a scalable, secure delivery API for sending transactional emails from websites and applications for clients who need to send email from their FileMaker solution. Mandrill is easy to get to know and once established, works well for targeted e-commerce and personalized one-to-one messages. For our discussion we will explain how the Mandrill Sample File constructs the URL to send to the Mandrill API, which then sends the email.

The benefits of sending email via Mandrill can be seen here: Mandrill Features. We were impressed with the simplicity of the process, but wanted to also add attachments to the emails to cover the many times that would come in handy from a business standpoint.

The screenshot shows the basic email form – the user creates a free account at Mandrill, subscribes to a paid MailChimp account (a fairly recent requirement), then uses the Mandrill Sample File to fill out the To/From information and message (seen on the left) and easily add an attachment, if needed. The right side shows the visual output of the custom functions and calculations that are generated at Mandrill.

image1

This blog post from Digital Fusion gives great information on how to construct this file: Sending email from FileMaker using Mandrill. Now, on to the fun stuff with the custom functions needed to add the attachments…

Custom Function: mandrill_createRequestInsertURL

File > Manage > Custom Functions > Edit (to see it).

This function takes in all the parameters (Example: To, From, Subject, API key, etc.) and creates the URL Request.

This function also uses a helper function called escapeData that handles any special characters in the email address, subject, etc.  (Example: &, %, `, etc.)

Custom Function: mandrill_attachmentCodeInsert

This function helps handle attaching the file to the email. Read more about the gritty details here: Sending email from FileMaker using Mandrill 

Now that we’ve used our custom function to create our URL request, it’s time to create the “InsertURL Template.” This is a calculated field that we use to finalize our URL request to the Mandrill API.

File > Manage > Database > Select the “Insert From URL Template” > click on Options (lower right)

As you can see once you’re viewing the calculated field, this uses the mandrill_createRequestInsertURL custom function and creates the URL we send to Mandrill.

To sum up, this is the structure of the URL used to build this function. Inputs from these two field ultimately create the URL to be used.

URL to Mandrill API / Insert From URL Results

URL to Mandrill API is always the same and should be pre-filled into the corresponding field. Insert From URL Results is the result of the custom function, mandrill_createRequestInsertURL and is ultimately a calculated field.

Now that we have our URL, the hard part is done and we just need a simple script to send the email.

sendEmail Script

Now that we have our URL constructed, the sendEmail script is a simple process. The meat and potatoes of this script is FileMaker’s “Insert from URL” function. We just pass in two fields that create this URL. We pass in the “URL to API” which is a constant, and add our calculated “Insert From URL Results” field to the end of the URL, and we’re good to go.

Image2

Attach this script to the “Send Email” button and you’re done! We would love to get your feedback on this script and learn how it has worked for you.

Get a PDF of this blog here: FileMaker Mandrill Integration

 

FileMaker Integration with Mandrill

Texting Clients Using Twilio

Twilio_logo_red

Twilio, a robust messaging software that offers a powerful instant messaging solution for companies large and small, works seamlessly with the FileMaker Platform to manage an otherwise roundabout method of contacting field staff and key partners. Read on to understand Twilio’s API and how Revolution11 integrates messaging features for our clients by utilizing a few simple PHP requests.

Understanding the Twilio API

Twilio is a cloud communications (IaaS) company that allows software developers to programmatically make and receive phone calls and send and receive text messages using its web service APIs. The services are accessed over HTTP and are billed based on usage. Twilio is a well-known player and has a large installed user base.

Twilio API and FileMaker

In the past year or so, there have been posts from FileMaker developers using the Twilio platform. Jeff England wrote a great post here: designingfilemaker.com

Colibri Solutions has a comprehensive post that goes over an integration strategy using SmartPill: colibrisolutions.com

Revolution11 recently developed a solution for a client that allowed them to send small audio/video and other files in addition to a text message via Twilio. Similar to the examples above we are using an HTTPS request and the Insert From URL script step in FileMaker.

How To Use Twilio

1. Sign up for a free Twilio account here: twilio.com.

2. Download the attached FileMaker Twilio Blog Sample.

3. Enter the Account ID, Token and Twilio phone number from your Twilio account in the corresponding fields in the demo file.

4. Add the mobile number you would like to send the SMS to in the “to_phone_number” field.

5. You can send audio or video by entering the URL of the media file in the media file field. It needs to be an unprotected site, you can use a public Google site to try the demo file. Read about the limitations on media here: twilio.com

The script in the demo file constructs an HTTPS request and sends it to the Twilio server, which processes the request sending an SMS using your Twilio phone number.

To Summarize

Digging into APIs such as the offerings from Twilio is well worth the effort. One script step and a carefully crafted HTTPS request can accomplish quite a bit once you understand the API. Stay tuned for a follow-up post where we will examine the Twilio API a little deeper and share some of our success stories.

Get PDF of this post: Twilio Sample File

Texting Clients Using Twilio