Capturing Button Data in a FileMaker Database

With a FileMaker database, it is possible to capture the JSON data generated by an AT&T LTE-M or AWS Enterprise Button. DB Services already wrote a great blog about using a

custom Lambda to record the JSON into a FileMaker Database from the 1st generation of AWS Buttons here: https://dbservices.com/articles/iot-filemaker-and-you/.  With the help of our friends at Tek-Connect, we decided to take it a step further and create a serverless app to make the process of capturing button clicks for these devices in FileMaker as easy as possible.

FileMaker’s ScriptMaker opens up a world of possibilities that customize what happens when pressing these buttons. In earlier blogs, we have demonstrated using Twilio for Text Messaging and Mandrill and MailChimp to send transactional email. You can build workflows using these tools with your FileMaker Solution. Perhaps a client wants their field reps to re-order products from the field using these buttons. With one click, a FileMaker solution can create an order record in a database, send a text to the rep and his customers letting them know the product(s) have been ordered, and send a notification to the warehouse to pick and ship the product. In future blogs, we will be exploring adding more functionality to these buttons.

How to Deploy and Use a Custom Serverless Application to Capture the JSON Button Output

Setting Up The Application

1. Log in to the AWS Console and choose the Lambda service. Once you are on the dashboard, press ‘Create Function’ in the upper right hand corner.

capturingfilemaker1

2. On the next screen, choose the AWS Serverless Repository (the last pane on the right).

capturingfilemaker2

3. In the search bar, type in “FileMaker” or “Revolution11” in the Public Applications area. Click on the rev11-attiotbutton-filemakerapi application.

capturingfilemaker3

4. A Read Me section is found in the middle of the page on the left-side; this provides the parameters necessary to use the application. (A sample FileMaker application can be downloaded with this blog post.) Fill out the parameters for your FileMaker Server, file, and other information on the right-hand side of the screen and press the ‘Deploy’ button.

capturingfilemaker4

5. A status screen will appear while the application is being deployed. Once the process finishes, press the Test App button in the upper right of the screen.

capturingfilemaker5

6. An overview screen for the app appears. Click on the hyper-linked name of the application (rev11atttiotbuttonfilemakerapi).

capturingfilemaker6

7. The next page sets up the function for the buttons. Add the AWS IoT trigger by clicking on it in the list of triggers to the right.

capturingfilemaker7

8. The AWS IoT Trigger appears in the workflow now. Scroll down to the configuration triggers area to set up the function to work with buttons.

capturingfilemaker8

9. It is possible to use one of the rules created for another button, but in case one has not been created, we will make a new one. Choose Custom IoT rule, give the rule a name and add a query statement as in the screenshot below. Press the save button in the upper right hand corner to save the changes.

capturingfilemaker9

10. Let’s test the function! On the top of the screen, find the dropdown to ‘Select a test event’. Since we haven’t created any tests to use, the only choice in the dropdown is to ‘Configure a test event’ — choose this option.

capturingfilemaker10

11. Go ahead and use the supplied Hello World template. Give the test event a name and press the Create button at the bottom right of the screen. This test will send the JSON in the body of the test with the function.

capturingfilemaker11

12. You will now see the name of the test you created in the dropdown. Press the Test button to the right of the dropdown to run the test.

capturingfilemaker12

13. When the test has finished running, you will see the results at the top of the page. In this case it was successful. Now, check your FileMaker Database, there should be a new record with the JSON from the test event.

capturingfilemaker13

14. In the event of an unsuccessful test, this same area will tell you what failed. For this screenshot, I have changed the name of the “field” environment variable to a field not in the database. You should see that error in the details.

capturingfilemaker14

Configuring the Button

1. Configuring the LTE-M or AWS to use this Lambda function is the same as in past blog posts. In the AWS Server Console, navigate to the one click service and click on ‘Create a project’.

capturingfilemaker15

2. Give the project a name and press next.

capturingfilemaker16

3. Press ‘Start’ to define a device template.

capturingfilemaker17

4. Press ‘All button types’ on the next screen.

capturingfilemaker18

5. Enter the Device template name; in the Action dropdown, choose ‘Select a Lambda’ function and choose the function that was just created when you created the application; press ‘Create project’.

capturingfilemaker19

6. On the next screen choose Create your first placement – click ‘Create placements’.

capturingfilemaker20

7. Give the placement a name and press the choose device button to choose a device to tie to the function.

capturingfilemaker21

8. On the next screen, select the device and press ‘Create placement’.

capturingfilemaker22

You can now test your button!

 

You can download a sample FileMaker File to host on your FileMaker Server here.

Download a PDF of this blog: Capturing Button Data in a FileMaker Database

Capturing Button Data in a FileMaker Database

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.