Dev Guide
Dev GuideUser GuideGitHubNuGetDevCommunityDoc feedbackLog In

Overview

Build a sample app from start to finish in Optimizely Connect Platform (OCP).

Build a sample app from start to finish in Optimizely Connect Platform (OCP) that allows customers to sync data from an Azure storage account to Optimizely Data Platform (ODP).

You will learn how to:

  • register and scaffold an app
  • add objects and fields to ODP schema
  • build a setting form that allows authentication in a third-party service (in this case, an Azure storage account)
  • build a function that listens to events from an Azure storage account and imports new data to ODP
  • build a job that periodically imports data from an Azure storage account to ODP
  • test and troubleshoot your app in a sandbox environment
  • publish your app to the ODP App Directory

App considerations

Any customers using this app should have a third-party system that can send data to an Azure storage account. For simplicity, this quickstart guide assumes that the data format is fixed and defined by the app.

📘

Note

Typically, the app needs to handle the data format defined by a third-party service.

App description

Ecommerce clients have successfully integrated their online stores with ODP. However, some also have offline stores that they wish to integrate as well. These clients push their offline store data and order info to an Azure storage account.

In this quickstart guide, the objective is to write an OCP app that pulls this data from Azure and writes it to ODP.

Orders will be pushed individually as JSON files, which contain the following order, customer, and offline store details:

  • order_id – string
  • product_id – string
  • price_total – number
  • customer_email – string
  • customer_clubcard_id – string
  • customer_clubcard_creation_date – timestamp
  • offline_store_id – string

Offline stores will be kept in a single JSONL file that is updated throughout the day:

  • id – string
  • name – string
  • location – string

Prerequisites

Configure resources in Azure

Configure the following resources in Azure:

  • An Azure resource group and storage account. Standard performance and local redundancy are sufficient, and all other default settings are ok.
  • Two containers in your Azure storage account; one for offline store data and one for offline orders data. Select the private container option for both.
  • Register the Event Grid resource provider for your subscription.
  • An app registration in Azure (Azure app) to access Azure resources programatically. Default settings are ok.
  • A client secret for the app registration.

    📘

    Note

    Store the secret securely when you create it because you cannot view it again.

  • The service principal associated with your app registration must have the following permissions:
    • Microsoft.EventGrid/eventSubscriptions/read
    • Microsoft.EventGrid/eventSubscriptions/write
    • Microsoft.Storage/storageAccounts/blobServices/read
    • Microsoft.Storage/storageAccounts/blobServices/containers/read

      📘

      Note

      The easiest way to do this is to assign the EventGrid EventSubscription Contributor and Storage Blob Data Reader roles to your service principal at the resource scope. Alternatively, you can assign roles at another scope (for example, storage account or subscription) or create and assign a custom role.

Get information from your Azure account

After you configure everything in Azure, you need the following information from your Azure account to test your app:

  • Azure client ID – Application (client) ID field of your Azure app registration.
  • Azure tenant ID – Find your Azure AD tenant or Directory (tenant) ID of your Azure app registration.
  • Azure client secret – The secret you created for your Azure app registration.
  • Azure Subscription Id – Find your Azure subscription.
  • Azure resource group
  • Azure storage account name
  • Azure storage container name

You are now ready to initialize the app and define its schema.