Capturing Button Data in a SQL Database

serverlessApp.png

With a SQL database it is possible to capture the JSON data generated by an AT&T LTE-M or AWS Enterprise Button. With the help of our friends at Tek-Connect, Revolution11 has created a serverless app to make the process of capturing button clicks for these devices in a SQL database as intuitive as possible.

Our serverless application supports the following flavors of SQL: MySQL, MS SQL, Postgres SQL, Oracle SQL, SQL Lite or Web SQL.

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 panel located on the right side.

capturingfilemaker2

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

CapturingSQL3.jpg

4. A Read Me section is found on the left-hand side of the page; this provides the parameters necessary to use the application. Fill out the parameters for your SQL Server address, sql type, and other information on the right-hand side of the page and press the ‘Deploy’ button.

capturingsql4

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.

CapturingSQL5.jpg

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

CapturingSQL6.jpg

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.

capturingsql7

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.

capturingsql8

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

CapturingSQL9.jpg

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.

CapturingSQL10.jpg

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.

CapturingSQL12.jpg

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 SQL Database, there should be a new record with the JSON from the test event.

capturingsql13

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 “column” environment variable to a column not in the database. You should see that error in the details.

CapturingSQL14.jpg

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!

 

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

Capturing Button Data in a SQL Database

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

AWS Enterprise Button Configuration

AWS.ATT.button.

Before Button Configuration, set up an Amazon Web Service (AWS) Account

Next, download the AWS IoT 1-Click App from either the iOS App Store or Google’s Play Store Order an AWS Enterprise Button Here (Affiliate Link Full Disclosure) :

Once you receive your AWS Button follow these steps to configure:

1. Open box by prying open the panel on the end that has the white sticker (Keep track of the box so you can scan the sticker with the app).

awsenterprise1

2. Log into the AWS IoT 1-ClickApplication

3. Configure the Button on your mobile device by opening the AWS IoT 1-Click and signing in with your AWS password. This opens the app for button configuration on the setup tab. Press the Claim with Device ID button

awsenterprise2

4. Press the scan button to scan the serial number on the box (You can enter the serial number manually if you have lost the box)

awsenterprise3

5. The app will display “1 Device Added” when it has identified the serial number.
Press ‘Stop Scanning’.

awsenterprise4

6. The Device Added Confirmation Screen will appear. Press the ‘Claim’ button to claim the device.

awsenterprise5

7. A pop-up will appear asking to confirm that you would like to configure this device. Press ‘Yes’.

awsenterprise6

8. On the next screen you will be instructed to Press the Button on the AWS Enterprise Device.

awsenterprise7

9. Once the device is found, the next screen will prompt you to add your wi-fi credentials for the wi-fi network you would like to use with this button. Enter your settings and press ‘Confirm’.

awsenterprise8

10. The configuration screen will show the configuration status change from ‘in progress’ to ‘succeeded’. Once the configuration has succeeded (the light on the device will change from flashing blue to a solid green flash), press the ‘next’ button.

awsenterprise10

11. The next screen will prompt you to press the button on the device to finalize the claim. Once this has succeed, press the ‘finish’ button.

awsenterprise11

12. Press the devices tab at the bottom of the screen to view the device in the app.
Click on the device in the list to enable it.

awsenterprise12

13. On the next screen, click on the ‘enable’ slider.

awsenterprise13

Configuring the Button Action

1. Log on to your AWS Console

2. Click ‘All Services’ and navigate to → Internet of Things → IoT 1-Click

3. Choose the 1-Click Service, this is what you will use to assign a Lambda Function to the device.

awsenterprise14

4. On the left hand side of the screen you will see the menu for managing 1-Click Devices

awsenterprise15

5. Click on the ‘Manage’ option in the 1-Click Menu

6. Create a test project to attach for the AWS Enterprise Button. Press the ‘Create a Project’ button.

awsenterprise16

7. Enter a Project name and Description and press the ‘Next’ button.

awsenterprise17

8. Press Start to Define a Device Template for the Lambda Function you want the device to use.

awsenterprise18

9. Name the template, and set an action (Lambda Function). In this case, choose ‘Send SMS’.

awsenterprise19

10. Scroll down to Create Placements and enter a device placement name and enter a phone number (+1xxxxxxxxxx) and write a message in the placement attributes. Press ‘Create Project’.

awsenterprise20

11. A confirmation screen will appear, press the ‘Create placements’ button.

awsenterprise21

12. On the next screen, give the placement a name and press the choose a device.

awsenterprise22

13. Click on ‘Choose’ next to the AWS Device

awsenterprise23

14. Press the ‘Create placement’ button at the bottom of the screen.

awsenterprise24

15. You will now see this device in the Placements for this Project.

awsenterprise25

16. Press the button once on the AWS Enterprise Device. When the light on the device turns solid green a text is sent to specified the number.

Download a PDF of this blog: AWS Enterprise Button Configuration

AWS Enterprise Button Configuration