Twilio Sample PHP & Instructions

Welcome back to Part 2 of the Revolution11 – Twilio/FileMaker integration where we have fun with Twilio, the service that allows you to make and receive phone calls and text messages using its web service APIs. In Part 1, we went over using a simple HTTPS request to send an SMS message, including a media file. In this post we will drill down into each individual piece that makes this integration possible and help you find the pieces to build it.

Previously we talked about:

  1. Integrating Twilio and FileMaker
  2. The PHP web service for retrieving texts from Twilio’s server

Here is a screenshot of the Twilio Demo File

FileMakerTwilio

As you can see from the screenshot, a few fields need to be populated:

  • account_id
  • token
  • from_phone_number
  • to_phone_number
  • Message

These fields are used to populate the variables used in the script to send the SMS message.

This is what the FileMaker script code looks like:

FMScript

The script checks that the required fields are not empty and that the phone numbers are formatted properly. The $post variable is set using the variables named earlier in the script, which sends a request to Twilio’s API. Twilio’s API takes the data that you are passing through this transaction, validates your Twilio account, and sends the message out.

Pretty fancy! but what happens when someone replies to that SMS? We can handle the reply easily with just a touch of PHP. In our example we are sending the replies to the SMS straight to an email address.

md2

This PHP file is kept on your FileMaker server, with the standard web configuration turned on. In the example, we have used “Your file path” so you can configure the PHP file for your server.

The header and echo tags are basically telling our application that this is the type of data that we are going to be receiving from Twilio’s server.

The next portion is variable creation and assignment. For example:

  • The $to variable – where we are sending the response message once it’s retrieved from Twilio’s server
  • The $subject variable – The subject of the message
  • The $message – The actual message and,
  • The $headers variable – the person the email was sent from

The final section is an HTTP request method that will send the reply email.

You obviously don’t want to have to muck with the PHP files on your server every time you want to change the reply action to the outgoing SMS message, so stay tuned for a future Revolution11 blog post where we show you a few ways to get these preferences out of your FileMaker solution.

Get a PDF of this post: Twilio Sample PHP

Twilio Sample PHP & Instructions

FileMaker Hosting Options

In today’s world, businesses of all sizes are seeking cloud applications to minimize their in-house IT footprint. Currently, FileMaker does not offer a true cloud-based solution. However, it is possible to have your FileMaker solution hosted, but it is important to consider a few options so the hosting company and product you choose will serve your company now and into the future.

Shared Hosting

Shared hosting is the most cost effective way to get started with FileMaker Server. With this option, the service provider hosts your FileMaker solution along with those of other companies. The price of this service usually depends on the number of files that will be hosted and the bandwidth consumed.

Some of the advantages of shared hosting include: low prices ($12.99 and up per month), vendors that manage FileMaker Server and backups for you, and vendors that also manage OS updates and the maintenance of the physical machine.

There are some disadvantages to hosting your files on the same server as others. Because many companies may be sharing the FileMaker Server, the server resources may be consumed by other solutions, degrading the performance for your solution. You are also reliant on the vendor if there are any issues using their self-help utilities to upload a copy of your solution, add changes to the application, and download copies of your solution for development.

Virtual Servers

For this option, the vendor creates and manages virtual OS instances upon which FileMaker Server is installed. Clients purchase their own FileMaker license for the server (some vendors will charge a monthly fee on top of the virtual hosting fee to “rent” the server software to you and install and manage FileMaker server) and install and manage the server and backups themselves.

Virtual Servers are a great way to have more control and better performance for your solution. Your solution is not impacted by the performance of any other FileMaker applications, and you can shut down/restart the server if necessary. Virtual servers are also great if you need to use web-based technologies outside of Web Direct.

Virtual servers are a little pricey, starting at $99 a month. Depending on the vendor you choose, you may also have to purchase, install and administer FileMaker Server yourself. This includes managing backups for your solution.

Dedicated/Co-located Servers

For larger, more intensive FileMaker solutions, you may need a dedicated server. Vendors may “rent” a server, operating system, and FileMaker Server software, or you may be required to provide these and the Vendor will provide a range of services, typically managing the hardware and operating system on the server.

Dedicated servers generally start in the $500 per month range and you will have the additional expense of FileMaker Server, the Operating System, and hardware. Revolution11 recommends that you carefully think about this investment if you purchase hardware or software. FileMaker will eventually have to produce a “true” cloud offering (We have no advance knowledge of such a product, but this is certainly an unstoppable industry trend); unless you can re-purpose the server, you may be very unhappy with the investment.

Get PDF of this post: FileMaker Hosting Options

 

FileMaker Hosting Options

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

Integrate Messaging Into Your FileMaker Solution

Real-Life Situation

It’s Friday evening and you notice that one of your field reps has ordered the wrong part. You have limited time to make the correction and ensure that the part gets to the customer on time. No need to panic as you know your enterprise FileMaker solution incorporates SMS or text messaging, as part of its communications strategy and you can easily send a text message to the field rep, clear up the misunderstanding, and get the part on its way.

What if more than one field rep was having the same issue? You could try an email blast, but you know that won’t be effective on a Friday night. You may have an SMS group ready to go and you can send a mass message out to the reps, however the chances of that are slim. You may also need to send out an important file, video or audio message with that SMS and you don’t have time to compose messages one-by-one when you have an urgent situation.

Real-Life Solution

Integrating SMS into your enterprise solution solves these problems and offers a convenient, effective way to communicate with your staff. Chances are that you already have the sales reps cell phone numbers in your system, along with part numbers, brochures, photos and other pertinent business information. Sending any combination of these components out to the field from your system using SMS becomes a powerful tool to manage communication and relay critical information.

One of the important features of using this method is that it works with most carriers and phones, even with Robert, the rep who refuses to replace his flip phone. You also control what happens when replies come back from the outgoing messages; keeping the back and forth communication logged into the SMS provides a record and eliminates the need to open other apps on the phone.

In Conclusion

There is great potential for enterprise SMS solutions as highlighted by the rising popularity of SMS in communicating more effectively with staff, managing delivery receipts, sending alerts from airlines regarding delays and critical updates, tracking inventory and managing stock alerts, just to name a few of the many services that SMS provides to millions of users on a daily basis.

Get PDF of this post: SMS Improves Communication

 

Integrate Messaging Into Your FileMaker Solution