Triggers: Getting Started (Step-By-Step Test)

Before we setup our first Trigger on a live data stream, let's walk through creating a test Trigger that will send a SMS and email on command.

Step 1: Create a Test Bucket



At the top of your bucket shelf, click the +cloud icon to create a new streaming bucket.

Name the new bucket (e.g. Trigger Test).  You can optionally configure the bucket key and access key used by clicking on the "Configure Endpoint Keys" checkbox.  


Click the "Create" button at the bottom and the new bucket should be listed at the top of your shelf.

Step 2: Send Data to Your Bucket



Click on the new bucket and open it in Tiles.  It should be empty.

Click on the "settings" link under the bucket name in the bucket shelf.  This will bring up the screen above.  Copy the text in the API Endpoint section and paste it in your favorite text editor.  We will use this to build a URL that we can use to send data into our newly created bucket.

In my example bucket, the text that I copied looks like:
https://groker.initialstate.com/api/events?accessKey=XrBbXmBI4CuyKq5DdZHkCJ2No6RCaM92&bucketKey=EW6YSRRDLRER

Your URL will have your accessKey and bucketKey. We need to add a stream name and value to the URL parameters to complete the URL. Add "&MyStream=off" to your URL (don't copy mine):
https://groker.initialstate.com/api/events?accessKey=XrBbXmBI4CuyKq5DdZHkCJ2No6RCaM92&bucketKey=EW6YSRRDLRER&MyStream=off

Paste your complete URL to the address bar of your browser and hit enter (or use the 'curl' command at a command prompt) to send the event, "off", to the stream, "MyStream", in your new bucket.



If you look at your bucket in Tiles now (you may have to refresh if you get impatient), a new Tile named MyStream should have appeared with the value of "off" displayed. You can send data to this stream again using the same URL but changing the value of MyStream (e.g. https://groker.initialstate.com/api/events?accessKey=XrBbXmBI4CuyKq5DdZHkCJ2No6RCaM92&bucketKey=EW6YSRRDLRER&MyStream=on).

Step 3: Configure A Trigger




Click on the "settings" link under the bucket name on the bucket shelf.
Click on the Triggers tab at the top. 
Add the trigger "MyStream = on" by filling out the fields and clicking the '+' icon.
Select the notification destinations. In the example above, I put a mobile number and email into the destination fields. You will be asked to enter in a verification code that will be sent to your phone if this is your first time using that mobile number with a trigger.  
Click "done" at the bottom to exit out of the trigger setup screen.
Your Trigger is now live and waiting to fire anytime MyStream = on.

Step 4: Fire the Trigger



Send "on" to MyStream using the same URL in Step 2.  You should get a text message within seconds of sending the data.  Check your email to verify that you also received a Trigger email.  



Feedback and Knowledge Base