Plum Fuse

Table of Contents

Messaging

« Prev Section Running Other Applications

The Send an Email, Fetch Twitter Feed, and Send an SMS modules can be used for messaging people within your application. The Send an Email module allows you to send e-mails through your application. The Fetch Twitter Feed module allows you to fetch tweets from Twitter accounts to use within your application.

Email

The Send an Email module can be used to send email messages from within your application. For our sample application, we're going to demonstrate how we can use this module to send an email.

First, drag a Yes or No module to your workspace and connect it to your Start module. In the textbox of the module, enter the following text: “Have you remembered to take your medicine today? Press 1 for yes or 2 for no.”

From here, drag a Send an Email module to your workspace and connect it to the Yes node of your Yes or No module. For SMTP URL, enter the URL of your SMTP server. For Port, enter the port that you want to use for your SMTP connection. For Username, enter the username of the email account. For Password, enter the password of the email account. In the From textbox, we're going to enter the email address of who the email is coming from. In the To textbox, we're going to enter the email address of who the email is going to. In the Subject textbox, we're going to enter the following text: “patient took their medicine.” In the Message textbox, we're going to enter the following text: “The patient took their medicine today.” Finally, drag a Hang Up or Exit module to your workspace and connect it to the “Sent” and “Not Sent” nodes of your Send an Email module.

Next, drag another Send an Email module to your workspace and connect it to the No node of your Yes or No module. For SMTP URL, enter the URL of your SMTP server. For Port, enter the port that you want to use for your SMTP connection. For Username, enter the username of the email account. For Password, enter the password of the email account. In the From textbox, we're going to enter the email address of who the email is coming from. In the To textbox, we're going to enter the email address of who the email is going to. In the Subject textbox, we're going to enter the following text: “patient did not take their medicine.” In the Message textbox, we're going to enter the following text: “The patient did not take their medicine today.” To finish the application, drag a Hang Up or Exit module to your workspace and connect it to the “Sent” and “Not Sent” nodes of your Send an Email modules.

From this example, the user is prompted to enter 1 for yes or 2 for no on if they had taken their medicine today. If the user entered 1 for yes, an email message is sent to drzeus@hospital.org that the patient has taken their medicine today. If the user entered 2 for no, an email message is sent to drknow@clinic.com that the patient has not taken their medicine today.

Twitter

The Fetch Twitter Feed module allows you to integrate your application with Twitter. You can fetch tweets from Twitter accounts and play those tweets within your application. For our sample application, we're going to demonstrate how to extract a tweet from a Twitter account and play it in your application.

First, drag a Fetch Twitter Feed module to your workspace and attach it to your Start module. In the “Username” textbox of the module, we're going to enter QuickFuseApps (this is the username of our Twitter account). In the “Number of tweets to fetch” textbox, we're going to enter 3 (this will take the top 3 tweets from our Twitter page and place them into a Stack).

Next, we're going to drag a Get Row from Stack module to our workspace and attach it to the Fetch Twitter Feed module. For the Menu Options of the Twitter feed access module, select the options for “Reassigned names” and “Get a specific row #”. This will allow us to extract the specific tweet that we want from the Stack. In the “Get the _ Row” textbox, we're going to enter 2. Also, since we're going to need to reference a variable in our Get Row from Stack module, drag out a Reserve Variable module to your workspace and declare a variable, myvar. Now, go back into your Get Row from Stack module and enter myvar in the Variable textbox. For Fieldname, select tweet as the field name.

From here, we're going to drag a Multipart Prompt module to your workspace and connect it to our Get Row from Stack module. In the textbox of our module, enter the following text: “Here's a tweet from our page:”. Then, click on the plus button to add a phrase/variable to your module and click on the toggler to convert it to a variable. Enter myvar as the variable.

To complete the application, drag out a Hang Up or Exit module to your workspace and connect it to your Multipart Prompt module.

From this example, the application first starts at the Fetch Twitter Feed module and fetches 3 tweets from the QuickFuseApps Twitter account and places them into a Stack. The Get Row from Stack module then extracts the 2nd tweet from that Stack and stores it in the variable, myvar. From here, the Multipart Prompt module states the tweet that was extracted to the user.

SMS

The Send an SMS module allows you to send text messages out via your application. For our sample application, we're going to demonstrate how to use the Send an SMS module to send out text messages.

First, drag out a Yes or No module to your workspace and connect it to your Start module. In the textbox of your Yes or No module, enter the following text: “Are you going to report for work today? Press 1 for yes or 2 for no.”

Next, drag out an Send an SMS module to your workspace and connect it to the Yes node of your Yes or No module. In the textbox of “Phone Number”, we're going to enter the phone number, 1234567890. In the textbox of “Message”, we're going to enter the following text: “Hi Assistant 1, you will need to report to work today.” To finish this branch of our application, we're going to drag a Hang Up or Exit module to our workspace and connect it to the “Sent” and “Not sent” nodes of our SMS module.

From here, drag out an Send an SMS module to your workspace and connect it to the No node of your Yes or No module. In the textbox of “Phone Number”, we're going to enter the phone number, 1234567890. In the textbox of “Message”, we're going to enter the following text: “Hi Assistant 1, you are not needed at work today.” To finish this branch of our application, we're going to drag a Hang Up or Exit module to our workspace and connect it to the “Sent” and “Not sent” nodes of our Send an SMS module.

From this example, the user is prompted to enter 1 for yes or 2 for no on if they're going to report to work today. If the user entered 1 for yes, a text message is sent to 1234567890 with the message, “Hi Assistant 1, you will need to report to work today.” If the user entered 2 for no, a text message is sent to 1234567890 with the message, “Hi Assistant 1, you are not needed at work today.”

Next Section » SOAP and REST Webservices
tutorial/app_basics/messaging.txt · Last modified: 2014/01/27 14:01 by victor