Learn How to Build IoT Apps with Node-RED, Watson AI Services – in this Hands-On Workshop

Workshop Social Tile-01

Learn how to build your first IoT application using Node-RED and IBM Watson Services. This workshop will begin with an introduction to Node-RED, a browser-based graphical flow editor of drag-n-drop blocks (called a node) of functionality. Node-RED (nodered.org) is an open-source community project built on top of the Node.js runtime. The workshop will dive into the Watson IoT dashboard to visualize data and Node-RED dashboard to build a UI interface.

AGENDA

12:00 – 12:50pm: Registration and Lunch
12:50 – 1:00: Intro/welcome from Max Katz, IBM Program Director, Developer Advocacy (@maxkatz)
1:00 – 1:30: Let’s Learn about Node-RED, JeanCarl Bisson, IBM Developer Advocate – Bluemix/Watson Developer Ecosystem (@dothewww)
1:30 – 2:30: IoT Starter Lab
2:30 – 3:00: Break
3:00 – 4:00: Watson IoT Dashboard
4:00 – 5:00: Node-RED Dashboard and Advanced Topics

After the workshop, stay for pizza, beer and learn about What’s New In JavaScript: Learn about Distributed Ledgers, IoT and Node-RED.

I’m an IBMer!

About four weeks ago I officially became an IBMer! I joined as San Francisco City Lead for Developer Advocacy.

Some of you are probably wondering why IBM? IBM is big, slow and boring. IBM is very big but it’s not slow or boring. IBM is over a 100 years old and it has repeatedly reinvented itself over and over — in one of the most competitive spaces: technology. Not many companies have done that.

History is great but that’s still not the reason to join a company. Number one is the people. IBMers are like one big family. People are awesome and smart. Always ready to help. I will be working with a team of awesome developer advocates, we will be running educational workshops, attending meetups, conferences, hold office hours and everything in between.  I will be working with teams who work with startups, enterprises, open source and education. I will also have a chance to work with VC companies, incubators and accelerators.

Our goal is to make you a better developer. We want to help you do your job faster and make your job easier. And that’s regardless if you go with IBM technology or not. Our job is to help you, the developer.

The second reason is the wide range of technologies and tools IBM has and has created. There are very few companies out there where you will be exposed to such wide range of technologies. We will be working on Watson, IoT, Containers, Blockchain, Serverless, Bluemix and other technologies.

It’s exciting and exciting time to be a developer!

Please reach out to say hi or if you think we can do something cool together.

My Last Day at Appery.io

Conference badges

Friday, May 5th 2017 was my last day at Appery.io. I’m taking a small break right now and will be starting my next adventure next week.

How to Send a Fax with Appery.io and Twilio Fax API

Twilio launched a new API that allows sending faxes. From the very start Appery.io platform made it very simple to connect to any external REST API. We love Twilio API and have an example and video on how to use the SMS API. The Fax API is as elegant and simple to use. In this blog post you will learn how to send a fax using the Twilio Fax API from a Server Code script.

Create a new Server Code script and copy the following script:

var url = "https://fax.twilio.com/v1/Faxes";
var accountSid = "AC3526fbeed7...............";
var token = "8703513246d3f445e............";
var to = "To number";
var from = "Your Twilio number"
var mediaUrl = "https://www.twilio.com/docs/documents/25/justthefaxmaam.pdf";

var XHRResponse = XHR2.send("POST", url, {
   "body": "To=" + encodeURIComponent(to) + "&From=" + encodeURIComponent(from) + "&MediaUrl="+mediaUrl,
   "headers": {
      Authorization: "Basic " + encodeBase64(accountSid + ":" + token),
      "Content-Type": "application/x-www-form-urlencoded"
   }
});

Apperyio.response.success(XHRResponse.body, "application/json");

The script is simple and does a POST request to the Twilio Fax API.

Line 1 is the Twilio Fax API endpoint.

Line 2 and 3 are Twilio Account SID and Auth Token. You can get both from the console dashboard.

Line 4 is where to send the fax (number).

Line 5 is your Twilio number.

Line 6 is a link to a document you want to fax. You can set it to any PDF file accessible via a direct link (or use the sample one provided by Twilio).

Line 8 is where the POST request is invoked with all the information.

Twilio Fax API uses Basic Authentication so the Account SID and Auth Token need to be encoded as Base64. There is an out-of-the-box plug-in that you can add to your account. The plug-in has a function to encode a string as Base64.

  1. Open the dropdown list (on the left) and select Back to list.
  2. Open the Plugins tab.
  3. Find the EncodeBase64 plugin and click insert to add it to your account. The plugin will be listed in the Library section. You can now use it in any other script.
  4. One more step is to add this library as a dependency for your script. Open that script you created. Go to Dependencies tab and click on EncodeBase64_Library.

You are ready to test the script.

Go back to the Script tab and open the Run tab (on the right). Click on Save and run button to invoke the API and send the fax.

The response should look like this:

{
   "date_updated": "2017-04-06T13:13:40Z",
   "date_created": "2017-04-06T13:13:40Z",
   "num_pages": null,
   "api_version": "v1",
   "media_url": null,
   "url":
   "https://fax.twilio.com/v1/Faxes/FX225bab5034cb8a335c45...............",
   "sid": "FX225bab5034cb8a335c45...............",
   "quality": "fine",
   "duration": null,
   "price_unit": null,
   "price": null,
   "account_sid": "AC3526fbeed7...............",
   "from": "+1415xxxxxxx",
   "to": "+1925xxxxxxx",
   "status": "queued",
   "direction": "outbound"
}

You can navigate to the URL set in the url attribute – there you will be able to see the status of the sent fax (the browser will ask you to login, use the Account SID and Auth Token values).

It can take a few minutes for the fax to be delivered, keep that in mind when testing. If you fax the pre-set PDF file then yon you will the following fax:

twilio-just-the-fax-man
Twilio sample fax

To learn more about Server Code check the Appery.io YouTube playlist. Happy faxing.

How to Expose a Database Stored Procedure and a Function as a REST API

Appery.io API Express makes it easy to expose a SQL query as a REST API. You can as easily expose a database stored procedure or a database function as a REST API. The following two blogs posts will teach you how to do that:

Want to learn more about API Express? Check our the Appery.io YouTube channel for videos on how to integrate with external data sources using API Express.

 

How Not to Send a Marketing Email

Today I received this email:

Subject: reconnect [company name]

Hi Max,

I noticed that Appery, LLC and [company name] had been in contact in the past and thought now would be a good time to reconnect.

Do you have a few minutes this afternoon?

[name]
Marketing Specialist

I deleted the email but then looked at it again.

There is absolutely zero value in this email (besides writing this blog post). Even if we had been in contact before, what are we connecting about now? This email shows that very little effort was put into writing this email.

I’d expect the first word in the subject to be capitalized. Also, there is no reason to say Appery, LLC. We don’t say Twitter Inc., or Facebook Inc.

If you want us to reconnect please tell me why you think we should connect. Maybe you just released a brand new API and built an app using Appery.io and want to show me the app so we can write a blog post about it. Something like this.

Video: How to Call WordPress REST API

Watch this short video to learn how to call the WordPress REST API from an Appery.io app. The video shows two approaches invoking the API.  First, it shows how to invoke an API using API Express. Second, it shows how to invoke an API from Server Code.

If you like this video, check the Appery.io YouTube channel for many more short videos to help you build apps faster.

Exposing a SQL Database via REST APIs: A Video Guide for Developers

Many organizations that are building mobile apps need to connect and reuse existing (internal) systems. One of the most common system is a relational (SQL) database. The question is — how to a relational database from a mobile app.

I have prepared two short videos that will show you how to do that using Appery.io API Express.

API Express connects to a relational database and exposes the database tables via REST APIs. Once the APIs are created, the mobile app can easily consume the APIs.

There are two approaches exposing a database:

The first approach automatically generates CRUD-like APIs to work with a database table. In many apps, this is close to 80% of what an app might need. This automatic approach also comes with very sophisticated offline support. In other words, you app can work offline and sync data with a remote database when a connection is reestablished.

With the second approach, you get full control as you write the actual SQL query (or Stored Procedure) that will be executed. With this approach, you can use a visual service editor to orchestrate the REST API. In addition to the SQL component (connector), you can use connectors such as Web Service (WSDL), REST  and others.

Check out the API Express video playlist to learn more.

How Appery.io Ensures API Express and Server Code On-demand Deployment

apperyio_ondemand_sc_aex_scheme

Appery.io had a strong 2016 and inches closer and closer to 400,000 developers. At the same time, the constant platform updates we roll out add more benefits, services, features, and options. Even without the constant updates, supporting a platform with so many developers would not be a simple task. Our platform has to be ready for continuous updates, increased load, and new user requests and requirements.

We want to provide high SLA level services and avoid unexpected slowdowns and downtimes for customers’ apps even during peak hours. To provide the required scalability and resilience, we rely on industry leader Amazon Web Services and its various features such as Auto Scaling, Launch Configurations, and CloudWatch.

In this blog post you will learn how exactly we ensure scalability and resilience for Appery.io API Express and Server Code services.

Continue reading on the Appery.io blog.

 

22 Things You Should Know About Appery.io Server Code

 

Appery.io Server Code allows you to write app logic with JavaScript which is executed on the server. Custom app logic is placed inside a Server Code script which is than invoked as a REST API from a mobile app. In this post you will learn everything you should know about Appery.io Server Code.

  1. Server Code is a server-side component in the Appery.io cloud platform.
  2. The code (logic) is placed inside a script which is executed on the server.
  3. You can write any custom app logic (you have access to most JavaScript APIs).
  4. The language used to write the Server Code script is JavaScript.
  5. A script is invoked as a REST API from a mobile app.
  6. A script can be tested (invoked) inside the Server Code dashboard.
  7. A script can depend on one more more libraries. A library is a reusable script (JavaScript code also).
  8. A script can connect and query the Appery.io Database.
  9. A script can send, manage and schedule Appery.io Push Notificationsa.
  10. A script can connect and invoke any 3rd party (external) REST API.
  11. A script can be secured with a username and password.
  12. A script can be scheduled as Job to run periodically and on schedule.
  13. A script can invoke another script.
  14. You can create versions of a script.
  15. A script has very fast cache called In Memory Data (data lives for 20 minutes).
  16. A script can be invoked from Appery.io API Express service flow.
  17. The script editor comes with Snippets, small reusable code which can be quickly inserted into a script.
  18. Server Code comes with Plug-ins. Plug-ins are scripts and libraries that can be quickly inserted and provide specific functionality such as integration with 3rd party APIs.
  19. A script has a Trace page where you can view console and error messages from script execution.
  20. A script has a Statistics page where you can view various statistics about a script such as how many times a script was invoked.
  21. A  script has a description field which can be invoked via a separate REST API for documentation purpose.
  22. The JavaScript engine used for Server Code is Nashorn.

Want to try Appery.io? Sign up for a free trial account in seconds.

Watch the Server Code YouTube playlist to learn more.