Can I use Azure Functions (serverless functions) to sync data from Talk2m to Microsoft Azure?

flexy
iiot
microsoft
azurefunctions
azure

#1

Can I use Azure Functions (serverless functions) to sync data from Talk2m to Microsoft Azure?


Data Mailbox Web API and Amazon Web Services (AWS)
Data mailbox access and info
Setting up eSync with a cloud based service
Esync from Flexy 503 error
#2

#4

It is possible to use Azure Functions to retrieve historical data from Talk2m’s Datamailbox service. The same function can also move that data into Azure storage, insert into Azure Table Storage, or an Azure Database, or even message and storage queues. Azure Functions can be timer or event triggered.

The following example function will make a query to Talk2M over HTTPS, and copy the contents to Azure Blob Storage.

Configure the function to be triggered by timer, the “Integrate” menu make this easy. The schedule is a CRON expression that represents trigger once, at the top of every hour.

Configure the output for Azure Blob Storage.

The following is the function call. Note that you’ll have to update the url parameter with your talk2m information.

using System;
using System.Net;
using System.IO;

public static void Run(TimerInfo myTimer, Stream outputBlob, TraceWriter log)
{
    string url = "https://data.talk2m.com/syncdata?t2maccount=myaccount&t2musername=myname&t2mpassword=mypassword#&t2mdevid=61ddac56-6976-4dde-adde-aed9dde788010&createTransaction&lastTransactionId=4567";

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    Stream resStream = response.GetResponseStream();

    resStream.CopyTo(outputBlob);

    log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
}

#13