Create a Contact

Creates a contact object in ChartMogul under a specified customer within the selected data_source.

Examples

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": "Adam",
            "last_name": "Smith",
            "position": 1,
            "title": "CEO",
            "email": "[email protected]",
            "phone": "+1234567890",
            "linked_in": "https://linkedin.com/example",
            "twitter": "https://twitter.com/example",
            "notes": "Heading\nBody\nFooter",
            "custom": [
              { "key": "Facebook", "value": "https://www.facebook.com/example" },
              { "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: "Adam",
  last_name: "Smith",
  position: 1,
  title: "CEO",
  email: "[email protected]",
  phone: "+1234567890",
  linked_in: "https://linkedin.com/example",
  twitter: "https://twitter.com/example",
  notes: 'Heading\nBody\nFooter',
  custom: {
    Facebook: "https://www.facebook.com/example",
    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: "Adam",
  last_name: "Smith",
  position: 1,
  title: "CEO",
  email: "[email protected]",
  phone: "+1234567890",
  linked_in: "https://linkedin.com/example",
  twitter: "https://twitter.com/example",
  notes: "Heading\nBody\nFooter",
  custom: [
    { key: "Facebook", value: "https://www.facebook.com/example" },
    { 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" => "Adam",
  "last_name" => "Smith",
  "position" => 1,
  "title" => "CEO",
  "email" => "[email protected]",
  "phone" => "+1234567890",
  "linked_in" => "https://linkedin.com/example",
  "twitter" => "https://twitter.com/example",
  "notes" => "Heading\nBody\nFooter",
  "custom" => [
    ["key" => "Facebook", "value" => "https://www.facebook.com/example"],
    ["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:      "Adam",
  LastName:       "Smith",
  LinkedIn:       "https://linkedin.com/example",
  Notes:          "Heading\nBody\nFooter",
  Phone:          "+1234567890",
  Position:       1,
  Title:          "CEO",
  Twitter:        "https://twitter.com/example",
  Custom: []cm.Custom{
    {
      Key:   "Facebook",
      Value: "https://www.facebook.com/example",
    },
    {
      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": "Adam",
    "last_name": "Smith",
    "position": 1,
    "title": "CEO",
    "email": "[email protected]",
    "phone": "+1234567890",
    "linked_in": "https://linkedin.com/example",
    "twitter": "https://twitter.com/example",
    "notes": "Heading\nBody\nFooter",
    "custom": [
      {"key": "Facebook", "value": "https://www.facebook.com/example"},
      {"key": "date_of_birth", "value": "1985-01-22"},
    ],
  },
)

Result Format

{
  "uuid": "con_653af916-dea0-11ed-845b-3be1ac0039ac",
  "customer_uuid": "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  "customer_external_id": "cus_0001",
  "data_source_uuid": "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  "position": 1,
  "first_name": "Adam",
  "last_name": "Smith",
  "title": "CEO",
  "email": "[email protected]",
  "phone": "+1234567890",
  "linked_in": "https://linkedin.com/example",
  "twitter": "https://twitter.com/example",
  "notes": "Heading\nBody\nFooter",
  "custom": {
    "Facebook": "https://www.facebook.com/example",
    "date_of_birth": "1985-01-22"
  }
}
#<ChartMogul::Contact:0x0000000128fada38
  @custom={
    :Facebook=>"https://www.facebook.com/example",
    :date_of_birth=>"1985-01-22"
  },
  @customer_external_id="cus_0001",
  @customer_uuid="cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  @data_source_uuid="ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  @email="[email protected]",
  @first_name="Adam",
  @last_name="Smith",
  @linked_in="https://linkedin.com/example",
  @notes="Heading\nBody\nFooter",
  @phone="+1234567890",
  @position=9,
  @title="CEO",
  @twitter="https://twitter.com/example",
  @uuid="con_653af916-dea0-11ed-845b-3be1ac0039ac"
>
{
  uuid: "con_653af916-dea0-11ed-845b-3be1ac0039ac",
  customer_uuid: "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  customer_external_id: "cus_0001",
  data_source_uuid: "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  position: 1,
  first_name: "Adam",
  last_name: "Smith",
  title: "CEO",
  email: "[email protected]",
  phone: "+1234567890",
  linked_in: "https://linkedin.com/example",
  twitter: "https://twitter.com/example",
  notes: "Heading\nBody\nFooter",
  custom: {
    Facebook: "https://www.facebook.com/example",
    date_of_birth: "1985-01-22"
  }
}
class ChartMogul\Contact (15) {
  protected $uuid => string(40) "con_653af916-dea0-11ed-845b-3be1ac0039ac"
  protected $customer_uuid => string(40) "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0"
  protected $data_source_uuid => string(39) "ds_35542640-d9f1-11ed-9c30-7727168c74a5"
  protected $customer_external_id => string(5) "cus_0001"
  protected $first_name => string(4) "Adam"
  protected $last_name => string(5) "Smith"
  protected $position => int(1)
  protected $email => string(16) "[email protected]"
  protected $title => string(3) "CEO"
  protected $notes => string(19) "Heading\nBody\nFooter"
  protected $phone => string(11) "+1234567890"
  protected $linked_in => string(29) "https://linkedin.com/example"
  protected $twitter => string(27) "https://twitter.com/example"
  protected $custom => array(2) {
    "Facebook" => string(35) "https://www.facebook.com/example"
    "date_of_birth" => string(10) "1985-01-22"
  }
}
(*chartmogul.Contact)(0x14000268000)({
  UUID: (string) (len=40) "con_653af916-dea0-11ed-845b-3be1ac0039ac",
  CustomerExternalID: (string) (len=12) "cus_0001",
  CustomerUUID: (string) (len=40) "cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  DataSourceUUID: (string) (len=39) "ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  FirstName: (string) (len=4) "Adam",
  LastName: (string) (len=5) "Smith",
  LinkedIn: (string) (len=29) "https://linkedin.com/example",
  Notes: (string) (len=19) "Heading\nBody\nFooter",
  Phone: (string) (len=11) "+1234567890",
  Position: (uint32) 1,
  Title: (string) (len=3) "CEO",
  Twitter: (string) (len=27) "https://twitter.com/example",
  Custom: (map[string]interface {}) (len=2) {
    (string) (len=8) "Facebook": (string) (len=35) "https://www.facebook.com/example",
    (string) (len=13) "date_of_birth": (string) (len=10) "1985-01-22"
  }
})
<Contact{
  custom={"Facebook": "https://www.facebook.com/example","date_of_birth": "1985-01-22"},
  customer_external_id="cus_0001",
  customer_uuid="cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0",
  data_source_uuid="ds_35542640-d9f1-11ed-9c30-7727168c74a5",
  email="[email protected]",
  first_name="Adam",
  last_name="Smith",
  linked_in="https://linkedin.com/example",
  notes="Heading\nBody\nFooter",
  phone="+1234567890",
  position=9,
  title="CEO",
  twitter="https://twitter.com/example"
  uuid="cus_52eb54c2-dea0-11ed-ac96-ef735d89fca0"
}>

In the response, the JSON object contains the following data:

  • uuid: The UUID of the contact.
  • customer_uuid: The UUID of the customer to which this contact belongs.
  • customer_external_id: The external id of the customer to which this contact belongs.
  • data_source_uuid: The custom data source UUID where you want to store this contact record. If an associated customer record does not exist in the defined custom source, ChartMogul creates one automatically and merges it into the customer you're adding the contact to. This allows you to add contacts to any custom source in your ChartMogul account, even sources where the customer you're adding the contact to has no prior relationship.
  • position: Position of the contact in the customer’s profile.
  • first_name: The first name of the contact.
  • last_name: The last name of the contact.
  • title: The job title of the contact.
  • email: The email address of the contact.
  • phone: The phone number of the contact.
  • linked_in: The URL of the contact's LinkedIn profile.
  • twitter: The URL of the contact's Twitter profile.
  • notes: Additional notes or comments about the contact.
  • custom: A dictionary of custom fields and their values that are specific to this contact.
Language
Credentials
Basic
base64
: