Add a Contact to Customer

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

Example

curl -X POST "https://api.chartmogul.com/v1/customers/cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580/contacts" \
     -u YOUR_API_KEY: \
     -H "Content-Type: application/json" \
     -d '{
            "data_source_uuid": "ds_92cc7226-509f-11ee-acf4-639f264f875d",
            "first_name": "Adam",
            "last_name": "Smith",
            "position": 9,
            "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" }
            ]
         }'
customer = ChartMogul::Customer.retrieve("cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580")
customer.create_contact(
  data_source_uuid: "ds_92cc7226-509f-11ee-acf4-639f264f875d",
  first_name: "Adam",
  last_name: "Smith",
  position: 9,
  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",
  },
)
const customerUuid = "cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580";

const data = {
  data_source_uuid: "ds_92cc7226-509f-11ee-acf4-639f264f875d",
  first_name: "Adam",
  last_name: "Smith",
  position: 9,
  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.Customer.createContact(config, customerUuid, data);
$customer = ChartMogul\Customer::retrieve("cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580");

$customer->createContact([
  "data_source_uuid" => "ds_92cc7226-509f-11ee-acf4-639f264f875d",
  "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.CreateCustomersContact(&cm.NewContact{
  DataSourceUUID: "ds_92cc7226-509f-11ee-acf4-639f264f875d",
  FirstName:      "Adam",
  LastName:       "Smith",
  Position:       1,
  Title:          "CEO",
  LinkedIn:       "https://linkedin.com/example",
  Phone:          "+1234567890",
  Twitter:        "https://twitter.com/example",
  Notes:          "Heading\nBody\nFooter",
  Custom: []cm.Custom{
    {
      Key:   "Facebook",
      Value: "https://www.facebook.com/example",
    },
    {
      Key:   "date_of_birth",
      Value: "1985-01-22",
    },
  },
}, "cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580")
chartmogul.Customer.createContact(
  config,
  uuid="cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580",
  data={
    "data_source_uuid": "ds_92cc7226-509f-11ee-acf4-639f264f875d",
    "first_name": "Adam",
    "last_name": "Smith",
    "position": 9,
    "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_d018335c-56d2-11ee-897c-830bb2bba6ec",
  "customer_uuid": "cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580",
  "customer_external_id": "customer_001",
  "data_source_uuid": "ds_92cc7226-509f-11ee-acf4-639f264f875d",
  "position": 9,
  "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="customer_001",
  @customer_uuid="cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580",
  @data_source_uuid="ds_92cc7226-509f-11ee-acf4-639f264f875d",
  @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_d018335c-56d2-11ee-897c-830bb2bba6ec"
>
{
  uuid: "con_d018335c-56d2-11ee-897c-830bb2bba6ec",
  customer_uuid: "cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580",
  customer_external_id: "customer_001",
  data_source_uuid: "ds_92cc7226-509f-11ee-acf4-639f264f875d",
  position: 9,
  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_d018335c-56d2-11ee-897c-830bb2bba6ec"
  protected $customer_uuid => string(40) "cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580"
  protected $data_source_uuid => string(39) "ds_92cc7226-509f-11ee-acf4-639f264f875d"
  protected $customer_external_id => string(5) "X1234"
  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_d018335c-56d2-11ee-897c-830bb2bba6ec",
  CustomerExternalID: (string) (len=12) "customer_001",
  CustomerUUID: (string) (len=40) "cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580",
  DataSourceUUID: (string) (len=39) "ds_92cc7226-509f-11ee-acf4-639f264f875d",
  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="external_001",
  customer_uuid="cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580",
  data_source_uuid="ds_92cc7226-509f-11ee-acf4-639f264f875d",
  email="[email protected]",
  first_name="First name",
  last_name="Last name",
  linked_in="https://linkedin.com/example",
  notes="Heading\nBody\nFooter",
  phone="+1234567890",
  position=9,
  title="Title",
  twitter="https://twitter.com/example"
  uuid="cus_3819e09a-50a2-11ee-ada7-9fcf71cd4580"
}>

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 UUID of the data source of the customer to which this contact belongs. A user can have multiple data sources, and the contact should only be associated to one of them.
  • 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
: