Close to Amazon S3

This page provides you with instructions on how to extract data from Close and load it into Amazon S3. (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 S3?

Amazon S3 (Simple Storage Service) provides cloud-based object storage through a web service interface. You can use S3 to store and retrieve any amount of data, at any time, from anywhere on the web. S3 objects, which may be structured in any way, are stored in resources called buckets.

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 Amazon S3

To upload files you must first create an S3 bucket. Once you have a bucket you can add an object to it. An object can be any kind of file: a text file, data file, photo, or anything else. You can optionally compress or encrypt the files before you load them.

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

S3 is great, but sometimes you want a more structured repository that can serve as a basis for BI reports and data analytics — in short, a data warehouse. Some folks choose to go with Amazon Redshift, Google BigQuery, PostgreSQL, Snowflake, Microsoft Azure SQL Data Warehouse, or Panoply, which are RDBMSes that use similar SQL syntax. 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 Azure SQL Data Warehouse, and To Panoply.

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 Amazon S3 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 Amazon S3 data warehouse.