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 Node.js 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.
Integrate with Azure services using Webhooks
You can use Kintone's webhooks with Azure Functions to integrate with various other Azure services.
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.
* For this article, we will choose "WebHook + API" and "JavaScript" for the third step.
Install the package modules
Follow the steps below to install the Node.js package.
Choose "Platform features" -> "Advanced tools (Kudu)".
A console screen will be displayed when Kudu is opened.
The package can be installed from this console.
Navigate to the Function folder that you created, from the folder links at the top of the page.
Run the npm command when you reach your destination. You will be asked a number 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.
(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 "Run".
If the code has run successfully, the Kintone records information should display in the log, and the status "200 OK" should display in the bottom right.
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.