Importing data for ChartMogul CRM

Follow this tutorial to import data for ChartMogul CRM using the API.

To use ChartMogul CRM, you’ll need to import leads (customers) and contacts. To migrate your CRM data to ChartMogul, import notes, call logs, and optionally, opportunities.

If you’re new to ChartMogul, create a source to store customers and contacts and import the following datasets:

  1. Customers (leads)
  2. Contacts
  3. Notes and call logs
  4. Opportunities (optional)

If you’re using Subscription Analytics and have an integration to import leads using the API, import the following datasets to your existing source:

  1. Contacts
  2. Notes and call logs
  3. Opportunities (optional)

📘

Alternative import methods

Importing data using the API is the best method for businesses with developer resources. Learn more about our integrations and non-programmatic import methods in Getting started with importing data for ChartMogul CRM.

Creating a source

Start by creating a custom source to store leads (customers) and contacts.

Use the Create a Source endpoint:

curl -X POST "https://api.chartmogul.com/v1/data_sources" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{ 
            "name": "CRM"
        }'
ChartMogul::DataSource.create!(name: "CRM")
ChartMogul.DataSource.create(config, {
  name: "CRM",
});
ChartMogul\DataSource::create([
  "name" => "CRM"
]);
api.CreateDataSource("CRM")
chartmogul.DataSource.create(config, data={"name": "CRM"})

Import leads (customers) and contacts to the same source, referencing the data_source_uuid you’ll receive in the response. Notes, call logs, and opportunities are tied to customers but stored outside sources. Follow the import order presented in this tutorial.

Importing leads

ChartMogul imports each lead as a customer object and creates a customer record.

Provide any customer custom attributes within the custom object. Specify each attribute’s type (String, Integer, Decimal, Timestamp, or Boolean), key (name), and value.

Use the Create a Customer endpoint to import leads:

curl -X POST "https://api.chartmogul.com/v1/customers" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
            "data_source_uuid": "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
            "external_id": "cus_0001",
            "country": "US",
            "state": "US-NY",
            "city": "New York",
            "company": "Myriapod Labs",
            "lead_created_at": "2024-05-14 00:00:00",
            "owner": "[email protected]",
            "attributes": {
              "tags": ["vip", "SaaStr2024"],
              "custom": [
                { "type": "String", "key": "industry", "value": "Fintech"},
                { "type": "Integer", "key": "company_size", "value": 120 }
              ]
            },
            "website_url": "https://myriapodlabs.com"
        }'
ChartMogul::Customer.create!(
  data_source_uuid: "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  external_id: "cus_0001",
  country: "US",
  state: "US-NY",
  city: "New York",
  company: "Myriapod Labs",
  lead_created_at: Time.utc(2024, 5, 14),
  owner: "[email protected]",
  attributes: {
    tags: ["vip", "SaaStr2024"],
    custom: [
      { type: "String", key: "industry", value: "Fintech" },
      { type: "Integer", key: "company_size", value: 120 },
    ],
  },
  website_url: "https://myriapodlabs.com",
)
ChartMogul.Customer.create(config, {
  data_source_uuid: "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  external_id: "cus_0001",
  country: "US",
  state: "US-NY",
  city: "New York",
  company: "Myriapod Labs",
  lead_created_at: "2024-05-14",
  owner: "[email protected]",
  attributes: {
    tags: ["vip", "SaaStr2024"],
    custom: [
      { type: "String", key: "industry", value: "Fintech" },
      { type: "Integer", key: "company_size", value: 120 },
    ],
  },
  website_url: "https://myriapodlabs.com",
});
ChartMogul\Contact::create([
  "customer_uuid" => "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  "data_source_uuid" => "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  "first_name" => "Sylvia",
  "last_name" => "Powers",
  "position" => 1,
  "title" => "CEO",
  "email" => "[email protected]",
  "phone" => "+5551167420",
  "linked_in" => "https://linkedin.com/in/sylviapowers",
  "twitter" => "https://x.com/sylviapowers",
  "custom" => [
    [ "key" => "communication_preference", "value" => "Phone" ],
    [ "key" => "date_of_birth", "value" => "1985-01-22" ]
  ],
]);
api.CreateCustomer(&cm.NewCustomer{
  DataSourceUUID: "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  ExternalID:     "cus_0001",
  Country:        "US",
  State:          "US-NY",
  City:           "New York",
  Company:        "Myriapod Labs",
  LeadCreatedAt:  "2024-05-14",
  Attributes: &cm.NewAttributes{
    Tags: []string{"vip", "SaaStr2024"},
    Custom: []*cm.CustomAttribute{
      {Type: "String", Key: "industry", Value: "Fintech"},
      {Type: "Integer", Key: "company_size", Value: 120},
    },
  },
  WebsiteUrl: "https://myriapodlabs.com",
})
chartmogul.Customer.create(
  config,
  data={
    "data_source_uuid": "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
    "external_id": "cus_0001",
    "country": "US",
    "state": "US-NY",
    "city": "New York",
    "company": "Myriapod Labs",
    "lead_created_at": "2024-05-14",
    "owner": "[email protected]",
    "attributes": {
      "tags": ["vip", "SaaStr2024"],
      "custom": [
        {
          "type": "String",
          "key": "industry",
          "value": "Fintech",
          "source": "integration",
        },
        {"type": "Integer", "key": "company_size", "value": 120},
      ],
    },
    "website_url": "https://myriapodlabs.com",
  },
)

Use each lead’s customer_uuid you’ll receive in the response to import the remaining datasets.

📘

Automatic merging of duplicate customers

Set up an automation to automatically merge leads imported using the API with matching customers imported from your billing system. This way you’ll avoid creating duplicate customer records.

Importing contacts

ChartMogul imports each contact as a contact object within a specified customer object.

Provide any contact custom attributes within the custom object. Specify each attribute’s key (name) and value.
The key must match one of the attribute names listed under Settings & Data > Custom Attributes > Contacts. To add a custom attribute outside of this list, first create it in ChartMogul.

Import contacts using the Create a Contact endpoint:

curl -X POST "https://api.chartmogul.com/v1/contacts" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
            "customer_uuid": "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
            "data_source_uuid": "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
            "first_name": "Sylvia",
            "last_name": "Powers",
            "position": 1,
            "title": "CEO",
            "email": "[email protected]",
            "phone": "+5551167420",
            "linked_in": "https://linkedin.com/in/sylviapowers",
            "twitter": "https://x.com/sylviapowers",
            "custom": [
              { "key": "communication_preference", "value": "Phone" },
              { "key": "date_of_birth", "value": "1985-01-22" }
            ]
         }'
ChartMogul::Contact.create!(
  customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  data_source_uuid: "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  first_name: "Sylvia",
  last_name: "Powers",
  position: 1,
  title: "CEO",
  email: "[email protected]",
  phone: "+5551167420",
  linked_in: "https://linkedin.com/in/sylviapowers",
  twitter: "https://x.com/sylviapowers",
  custom: {
    communication_preference: "Phone",
    date_of_birth: "1985-01-22",
  },
)
ChartMogul.Contact.create(config, {
  customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  data_source_uuid: "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  first_name: "Sylvia",
  last_name: "Powers",
  position: 1,
  title: "CEO",
  email: "[email protected]",
  phone: "+5551167420",
  linked_in: "https://linkedin.com/in/sylviapowers",
  twitter: "https://x.com/sylviapowers",
  custom: [
    { key: "communication_preference", value: "Phone" },
    { key: "date_of_birth", value: "1985-01-22" },
  ],
});
ChartMogul\Contact::create([
  "customer_uuid" => "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  "data_source_uuid" => "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  "first_name" => "Sylvia",
  "last_name" => "Powers",
  "position" => 1,
  "title" => "CEO",
  "email" => "[email protected]",
  "phone" => "+5551167420",
  "linked_in" => "https://linkedin.com/in/sylviapowers",
  "twitter" => "https://x.com/sylviapowers",
  "custom" => [
    [ "key" => "communication_preference", "value" => "Phone" ],
    [ "key" => "date_of_birth", "value" => "1985-01-22" ]
  ],
]);
api.CreateContact(&cm.NewContact{
  CustomerUUID:   "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  DataSourceUUID: "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  FirstName:      "Sylvia",
  LastName:       "Powers",
  LinkedIn:       "https://linkedin.com/in/sylviapowers",
  Phone:          "+5551167420",
  Position:       1,
  Title:          "CEO",
  Twitter:        "https://x.com/sylviapowers",
  Custom: []cm.Custom{
    {
      Key:   "communication_preference",
      Value: "Phone",
    },
    {
      Key:   "date_of_birth",
      Value: "1985-01-22",
    },
  },
})
chartmogul.Contact.create(
  config,
  data={
    "customer_uuid": "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
    "data_source_uuid": "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
    "first_name": "Sylvia",
    "last_name": "Powers",
    "position": 1,
    "title": "CEO",
    "email": "[email protected]",
    "phone": "+5551167420",
    "linked_in": "https://linkedin.com/in/sylviapowers",
    "twitter": "https://x.com/sylviapowers",
    "notes": "Heading\nBody\nFooter",
    "custom": [
      {"key": "communication_preference", "value": "Phone"},
      {"key": "date_of_birth", "value": "1985-01-22"},
    ],
  },
)

Importing notes and call logs

ChartMogul imports each note or call log as a note object with either a note or call type within a specified customer object.

Only import notes and call logs that are commercially valuable and provide relevant data for your team.

For call logs, use the call_duration property to specify call duration in seconds. If not set, it defaults to 60 seconds.

Import notes and call logs using the Create a Note or Call Log endpoint:

curl -X POST "https://api.chartmogul.com/v1/customer_notes" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
            "customer_uuid":"cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
            "type": "note",
            "author_email": "[email protected]",
            "text": "Took part in our May webinar",
            "created_at":"2024-06-11T00:00:00Z"
        }'
ChartMogul::Note.create!(
  customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  type: "note",
  author_email: "[email protected]",
  text: "Took part in our May webinar",
  created_at: Time.utc(2024, 6, 11),
)
ChartMogul.CustomerNote.create(config, {
  customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  type: "note",
  author_email: "[email protected]",
  text: "Took part in our May webinar",
  created_at: "2024-06-11T00:00:00Z",
});
ChartMogul\CustomerNote::create([
  "Customer_uuid" => "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  "type" => "note",
  "author_email" => "[email protected]",
  "text" => "Took part in our May webinar",
  "created_at" => "2024-06-11T00:00:00Z"
]);
api.CreateNote(&cm.NewNote{
  CustomerUUID: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  Type:         "note",
  Text:         "Took part in our May webinar",
  CreatedAt:    "2024-06-11T00:00:00Z",
})
chartmogul.CustomerNote.create(
  config,
  data={
    "customer_uuid": "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
    "type": "note",
    "author_email": "[email protected]",
    "text": "Took part in our May webinar",
    "created_at": "2024-06-11T00:00:00Z",
  },
)

Importing opportunities

ChartMogul imports each opportunity as an opportunity object within a specified customer object.

We don’t recommend importing historical opportunities. Only import opportunities that are in an active sales process. Depending on the number of opportunities, you may want to create them manually.

Provide any opportunity custom attributes within the custom object. Specify each attribute’s key (name) and value.
The key must match one of the attribute names listed under Settings & Data > Custom Attributes > Opportunities. To add a custom attribute outside of this list, first create it in ChartMogul.

Import opportunities using the Create an Opportunity endpoint:

curl -X POST "https://api.chartmogul.com/v1/opportunities" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
            "customer_uuid": "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
            "owner": "[email protected]",
            "pipeline": "New Business",
            "pipeline_stage": "Discovery",
            "estimated_close_date": "2024-07-15",
            "currency": "USD",
            "amount_in_cents": 100000,
            "type": "recurring",
            "forecast_category": "best_case",
            "win_likelihood": 40,
            "custom":[
              {"key": "seats", "value": 3},
              {"key": "product", "value": "CRM"}
            ]
        }'
ChartMogul::Opportunity.create!(
  customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  owner: "[email protected]",
  pipeline: "New Business",
  pipeline_stage: "Discovery",
  estimated_close_date: "2024-07-15",
  currency: "USD",
  amount_in_cents: 100_000,
  type: "recurring",
  forecast_category: "best_case",
  win_likelihood: 30,
  custom: [
    { key: "seats", value: 3 },
    { key: "product", value: "CRM" },
  ],
)
ChartMogul.Opportunity.create(config, {
  customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  owner: "[email protected]",
  pipeline: "New Business",
  pipeline_stage: "Discovery",
  estimated_close_date: "2024-07-15",
  currency: "USD",
  amount_in_cents: 100_000,
  type: "recurring",
  forecast_category: "best_case",
  win_likelihood: 30,
  custom: [
    { key: "seats", value: 3 },
    { key: "product", value: "CRM" },
  ],
});
ChartMogul\Opportunity::create([
  "customer_uuid" => "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  "owner" => "[email protected]",
  "pipeline" => "New Business",
  "pipeline_stage" => "Discovery",
  "estimated_close_date" => "2024-07-15",
  "currency" => "USD",
  "amount_in_cents" => 100,
  "type" => "recurring",
  "forecast_category" => "pipeline",
  "win_likelihood" => 3,
  "custom" => [
    [ "key" => "seats", "value" => 3 ],
    [ "key" => "product", "value" => "CRM" ]
  ]
]);
api.CreateOpportunity(&cm.NewOpportunity{
  CustomerUUID:       "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  Owner:              "[email protected]",
  Pipeline:           "New Business",
  PipelineStage:      "Discovery",
  EstimatedCloseDate: "2024-07-15",
  Currency:           "USD",
  AmountInCents:      100,
  Type:               "recurring",
  ForecastCategory:   "pipeline",
  WinLikelihood:      3,
  Custom: []cm.Custom{
    {
      Key:   "seats",
      Value: 3,
    },
    {
      Key:   "product",
      Value: "CRM",
    },
  },
})
chartmogul.Opportunity.create(
  config,
  data={
    "customer_uuid": "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
    "owner": "[email protected]",
    "pipeline": "New Business",
    "pipeline_stage": "Discovery",
    "estimated_close_date": "2024-07-15",
    "currency": "USD",
    "amount_in_cents": 100,
    "type": "recurring",
    "forecast_category": "pipeline",
    "win_likelihood": 3,
    "custom": [
      {"key": "seats", "value": 3},
      {"key": "product", "value": "CRM"},
    ],
  },
)

Enriching CRM data

Import additional details your team needs to leverage CRM functionality as custom attributes. These can include a lead’s industry, a contact’s preferred communication method, or the number of seats associated with an opportunity.
ChartMogul allows you to import custom attributes to customers (leads), contacts, and opportunities.
To import custom attributes for each dataset, follow the instructions in the sections above.

Next steps

Once you complete the steps above, connect your email account, review the default pipelines, and begin managing sales in ChartMogul.