kintone x Azure Functions (Part 1)

Introduction

This article introduces an integration between kintone and Microsoft Azure Functions.

What is Microsoft Azure?

Microsoft Azure is a set of cloud services that supports analytics, computing, databases, mobile, network, storage and web functions. Azure can manage virtual machines, big data, machine learning, IoT etc.
In this article, we will integrate Azure Functions with kintone.

Azure Functions is a "serverless computing" service that can run programming codes in response to triggers, similar to AWS Lambda.

From the browser, you can set up Cron jobs for batch processing, and set up NodeJS and C# codes to run from HTTP triggers (Webhooks). 

Examples of using Azure Functions

Run kintone REST APIs periodically

You can set Cron expressions to periodically run codes on Azure Functions to access kintone data with kintone REST APIs.

image_01.PNG

Integrate with Azure services using Webhooks

You can use kintone's webhooks with Azure Functions to integrate with various other Azure services.

image_02.PNG

 

Follow the steps below to prepare Azure Functions.

Prepare the Azure Functions environment

Create an account and set up Azure Functions

Prepare an Azure Functions environment with the following steps.

  1. Create a Microsoft Azure account
  2. Prepare Azure Functions
  3. Create Functions

* For this article, we will choose "WebHook + API" and "JavaScript" for the third step.

US_1.PNG

Install the package modules

Follow the steps below to install the NodeJS package.

 

Choose "Platform features" -> "Advanced tools (Kudu)".

US_2.PNG

 

A console screen will be displayed when Kudu is opened.
The package can be installed from this console.

US_3.PNG

 


Navigate to the Function folder that you created, from the folder links at the top of the page.

 

US_4.PNG



Run the npm command when you reach your destination. You will be asked a lot of questions, but you can just enter the "name" and "description", and then skip the rest by holding Enter.



Install the following packages:

  • request
  • request-promise


A node_modules folder and package.json file will be created after the installation is complete.

Open package.json and make sure that the settings are as follows:

 

The Function Editor

This is the Function Editor where the code will be managed.

US_5.PNG


(1) The Endpoint URL. Azure Functions executes the code when an HTTP request is made to this URL.

(2) The code editor, including the code that will run.

(3) An area to display context logs when the code runs.

(4) An area to display the directory in a folder tree.

(5) The parameters used when running the code.

(6) An area to display the responses from the running code.

Write the code

Once Azure Functions is ready, you can start to input the code.

The following is a sample that gets record data from kintone and displays it in the log.

Copy and paste the JavaScript code above to the code editor in Azure Functions. Modify the variable values for the kintone URL, App ID and the authentication info.

Save the code and click on "Run".

If the code has run successfully, the information of kintone records should display in the log, and the status  "200 OK" should display in the bottom right.

US_6.PNG

Finally

This article introduced how to set up Microsoft Azure Functions to get data from a kintone App. In the next articles, we will go through the steps on how to automate these calls, instead of manually running them.

Was this article helpful?
0 out of 0 found this helpful
Comments
Please sign in to leave a comment.