Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: (Classic)

Objective

In this exercise you will learn how to develop multiple ruleset applications.

Setup

Exercise

  1. Create and activate a ruleset named sms_blog_data
    1. Add a rule named inbound_sms that listens for twilio:inbound_sms events. The attribute to this event will be Body.
    2. When the inbound_sms rule fires, it should store the Body attribute in a map entity variable, with the current time as the key and Body as the value.

    3. Finally, in the postlude put the map entity variable into the persistent application variable sms_articles
    4. Add a new rule named retrieve_data that listens for explicit:need_blog_data
    5. When the need_blog_data rule fires, raise an explicit event named blog_data_ready with the persistent application variable sms_articles as a parameter for the ruleset named sms_blog.
  2. Create and activate another ruleset named sms_blog
    1. Add a rule named init_blog the listens for a pageview event.
    2. When the pageview event fires an html DIV container (with an id of blogbody) will be appended to the DOM body with an unordered list.
    3. In the postlude raise an explicit event container_ready.
    4. Also raise an explicit event need_blog_data for the sms_blog_data ruleset.
    5. Add a new rule named show_articles that listens for both explicit:container_ready and explicit:blog_data_ready.
    6. When the show_articles rule fires, iterate over each of the hash values in the map attribute sms_articles, recall that the hash key is the postTime and the value is the postBody.
    7. Format and append each item as a list item into the unordered list contain.
  3. Configure Twilio
    1. In your Twilio account, create a new app called smsBlog.
    2. Create an ESL (using the alternate syntax where the event domain and type are in the path) to raise twilio:inbound_sms to your pico (where the rulesets from the two previous steps are installed). Use that ESL for the sms request URL in Twilio. 
    3. Set up a new number, and select smsBlog as the app for SMS.