In this article, kintone will add data into Azure Storage using Azure Functions.
Azure Functions can work flexibly with Azure services, achieving integration using triggers and bindings with minimal amount of code, and is able to store NoSQL table data blobs, queues, and files.
Let's set up the integration by following the steps below.
The Integration Image
Azure Functions is called when a record is added into kintone, and the record data is added to Azure Table Storage.
The integration flow
Data stored in kintone that will be also stored into Microsoft Azure
Prepare the kintone App
We will use the App template below, to create an App to integrate with Azure functions:
AzureFunctions integration (product DB).zip
Move on to the next section after successfully creating the App in your kintone domain.
Prepare Azure Storage
The "Microsoft Azure Storage Explorer" client tool will be used in this article to utilize Azure Storage. Download and install the tool from here.
Learn how to use Azure Storage Explorer from here
Prepare Azure Functions
Create the settings with reference to this document.
Once the function is created, choose "New Output".
Choose "Azure Table Storage".
For the "Table name", input a name that matches the table name in Azure Storage.
Check that the same name is used in Azure Storage.
Once you finish configuring Azure Table Storage, delete the default HTTP output settings on Azure Functions.
If there is only Azure Table Storage left in the settings for the output, the setup is complete.
The Source Code
Prepare some code for Azure Functions.
Refer to this page for information on where to enter the source code for Azure Functions.
index.js for Azure Functions
RowKey, PartitionKey, id, name, and price are the field names of the table where data will be sent to.
function.json for Azure Functions
This json configures the in/out settings for Azure Functions. The json sets HTTP Triggers as the input and the Table of Azure Storage as the output.
The values below must be reconfigured accordingly to your Azure Storage environment.
Webhook settings for the kintone App
Webhooks will be set up on the kintone App, so that data is sent to Azure Functions when a new record is added.
First on Azure Functions, click on the "Get function URL" link for index.json.
Copy the URL displayed in the dialog.
Navigate to your kintone domain, and to your App's settings. Click on "Webhook" to access the webhook settings.
Click on the + button to add a new Webhook setting. Paste in the URL that you copied earlier from Azure Functions in the previous step, and also check the "Record is added" option for the Events.
Save your settings, and update your App.
Now every time you add a new record to your kintone App, the App will send the record information to Azure Functions, for the index.js code to process.
Test the integration
Add several records into your kintone App. If successful, you should see the contents stored in the kintone record being added into Azure Storage, as shown below.
This article introduced a powerful way for kintone to interact with Azure Storage. Note that you can set several webhooks in kintone, so that you can further expand this integration to update data in Azure Storage when a record in the kintone App is updated, or delete data in Azure storage when a record in the kintone App is deleted.