Close to Azure Synapse

This page provides you with instructions on how to extract data from Close and load it into Azure Synapse. (If this manual process sounds onerous, check out Stitch, which can do all the heavy lifting for you in just a few clicks.)

What is Close?

Close provides an inside sales SaaS and CRM platform that bundles calling, SMS, and email in a single platform. Users can make and receive calls and take business notes without getting on a phone or leaving the application. The software provides a single automated sales workflow system.

What is Azure Synapse?

Azure Synapse (formerly Azure SQL Data Warehouse) is a cloud-based petabyte-scale columnar database service with controls to manage compute and storage resources independently. It offers encryption of data at rest and dynamic data masking to mask sensitive data on the fly, and it integrates with Azure Active Directory. It can replicate to read-only databases in different geographic regions for load balancing and fault tolerance.

Getting data out of Close

You can use Close's REST API to get data about contacts, leads, opportunities, and many more objects into your data warehouse. For example, to get a lead, you could GET /lead/{id}/.

Sample Close data

Here's an example of the kind of response you might see when querying a lead.

{
    "status_id": "stat_1ZdiZqcSIkoGVnNOyxiEY58eTGQmFNG3LPlEVQ4V7Nk",
    "status_label": "Potential",
    "tasks": [],
    "display_name": "Wayne Enterprises (Sample Lead)",
    "addresses": [],
    "name": "Wayne Enterprises (Sample Lead)",
    "contacts": [
        {
            "name": "Bruce Wayne",
            "title": "The Dark Knight",
            "date_updated": "2019-01-06T20:53:01.954000+00:00",
            "phones": [
                {
                    "phone": "+16503334444",
                    "phone_formatted": "+1 650-333-4444",
                    "type": "office"
                }
            ],
            "created_by": null,
            "id": "cont_o0kP3Nqyq0wxr5DLWIEm8mVr6ZpI0AhonKLDG0V5Qjh",
            "organization_id": "orga_bwwWG475zqWiQGur0thQshwVXo8rIYecQHDWFanqhen",
            "date_created": "2019-01-01T00:54:51.331000+00:00",
            "emails": [
                {
                    "type": "office",
                    "email_lower": "thedarkknight@close.io",
                    "email": "thedarkknight@close.io"
                }
            ],
            "updated_by": "user_04EJPREurd0b3KDozVFqXSRbt2uBjw3QfeYa7ZaGTwI"
        }
    ],
    "custom.lcf_ORxgoOQ5YH1p7lDQzFJ88b4z0j7PLLTRaG66m8bmcKv": "Website contact form",
    "date_updated": "2019-01-06T20:53:01.977000+00:00",
    "html_url": "https://app.close.io/lead/lead_IIDHIStmFcFQZZP0BRe99V1MCoXWz2PGCm6EDmR9v2O/",
    "created_by": null,
    "organization_id": "orga_bwwWG475zqWiQGur0thQshwVXo8rIYecQHDWFanqhen",
    "url": null,
    "opportunities": [
        {
            "status_id": "stat_4ZdiZqcSIkoGVnNOyxiEY58eTGQmFNG3LPlEVQ4V7Nk",
            "status_label": "Active",
            "status_type": "active",
            "date_won": null,
            "confidence": 75,
            "user_id": "user_scOgjLAQD6aBSJYBVhIeNr6FJDp8iDTug8Mv6VqYoFn",
            "contact_id": null,
            "updated_by": null,
            "date_updated": "2019-01-01T00:54:51.337000+00:00",
            "value_period": "one_time",
            "created_by": null,
            "note": "Bruce needs new software for the Bat Cave.",
            "value": 50000,
            "value_formatted": "$500",
            "value_currency": "USD",
            "lead_name": "Wayne Enterprises (Sample Lead)",
            "organization_id": "orga_bwwWG475zqWiQGur0thQshwVXo8rIYecQHDWFanqhen",
            "date_created": "2019-01-01T00:54:51.337000+00:00",
            "user_name": "P F",
            "id": "oppo_8eB77gAdf8FMy6GsNHEy84f7uoeEWv55slvUjKQZpJt",
            "lead_id": "lead_IIDHIStmFcFQZZP0BRe99V1MCoXWz2PGCm6EDmR9v2O"
        },
        {
            "id": "oppo_klajsdflf8FMy6GsNHEy84f7uoeEWv55slvUjKQZpJt",
            "organization_id": "orga_bwwWG475zqWiQGur0thQshwVXo8rIYecQHDWFanqhen",
            "lead_id": "lead_IIDHIStmFcFQZZP0BRe99V1MCoXWz2PGCm6EDmR9v2O",
            "lead_name": "Wayne Enterprises (Sample Lead)",
            "status_id": "stat_4ZdiZqcSIkoGVnNOyxiEY58eTGQmFNG3LPlEVQ4V7Nk",
            "status_label": "Active",
            "status_type": "active",
            "value": 5000,
            "value_period": "monthly",
            "value_formatted": "$50 monthly",
            "value_currency": "USD",
            "date_won": null,
            "confidence": 75,
            "note": "Bat Cave monthly maintenance cost",
            "user_id": "user_scOgjLAQD6aBSJYBVhIeNr6FJDp8iDTug8Mv6VqYoFn",
            "user_name": "P F",
            "contact_id": null,
            "created_by": null,
            "updated_by": null,
            "date_created": "2019-01-01T00:54:51.337000+00:00",
            "date_updated": "2019-01-01T00:54:51.337000+00:00"
        }
    ],
    "updated_by": "user_04EJPREurd0b3KDozVFqXSRbt2uBjw3QfeYa7ZaGTwI",
    "date_created": "2019-01-01T00:54:51.333000+00:00",
    "id": "lead_IIDHIStmFcFQZZP0BRe99V1MCoXWz2PGCm6EDmR9v2O",
    "description": ""
}

Loading data into Azure Synapse

Azure Synapse provides a multi-step process for loading data. After extracting the data from its source, you can move it to Azure Blob storage or Azure Data Lake Store. You can then use one of three utilities to load the data:

  • AZCopy uses the public internet.
  • Azure ExpressRoute routes the data through a dedicated private connection to Azure, bypassing the public internet by using a VPN or point-to-point Ethernet network.
  • The Azure Data Factory (ADF) cloud service has a gateway that you can install on your local server, then use to create a pipeline to move data to Azure Storage.

From Azure Storage you can load the data into Azure Synapse staging tables by using Microsoft's PolyBase technology. You can run any transformations you need while the data is in staging, then insert it into production tables. Microsoft offers documentation for the whole process.

Keeping Close data up to data

Now what? You've built a script that pulls data from Close and loads it into your data warehouse, but what happens tomorrow when you have new transactions?

The key is to build your script in such a way that it can identify incremental updates to your data. Thankfully, Close's API results include fields like date_created that allow you to identify records that are new since your last update (or since the newest record you've copied). Once you've take new data into account, you can set your script up as a cron job or continuous loop to keep pulling down new data as it appears.

Other data warehouse options

Azure Synapse is great, but sometimes you need to optimize for different things when you're choosing a data warehouse. Some folks choose to go with Amazon Redshift, Google BigQuery, PostgreSQL, Snowflake, or Panoply, which are RDBMSes that use similar SQL syntax. Others choose a data lake, like Amazon S3. If you're interested in seeing the relevant steps for loading data into one of these platforms, check out To Redshift, To BigQuery, To Postgres, To Snowflake, To Panoply, and To S3.

Easier and faster alternatives

If all this sounds a bit overwhelming, don’t be alarmed. If you have all the skills necessary to go through this process, chances are building and maintaining a script like this isn’t a very high-leverage use of your time.

Thankfully, products like Stitch were built to move data from Close to Azure Synapse automatically. With just a few clicks, Stitch starts extracting your Close data via the API, structuring it in a way that's optimized for analysis, and inserting that data into your Azure Synapse data warehouse.