Create a data attribute
Example Requests & Response
$ curl https://api.intercom.io/data_attributes \\\n-X POST \\\n-H 'Authorization:Bearer <Your access token>' \\\n-H 'Accept: application/json' \\\n-H 'Content-Type: application/json' -d\n\n{\n \"name\": \"list_cda\",\n \"description\": \"You are either alive or dead\",\n \"data_type\": \"options\",\n \"model\": \"contact\",\n \"options\": [\n {\"value\": \"alive\"},\n {\"value\": \"dead\"}\n ]\n}
Example Errors
HTTP/1.1 400 BAD REQUEST
{
"type": "error.list",
"request_id": "0006klvnje6ffng7ot80",
"errors": [
{
"code": "parameter_invalid",
"message": "You already have 'text_cda' in your people data. To save this as new company data, use a different name."
}
]
}
HTTP/1.1 400 BAD REQUEST
{
"type": "error.list",
"request_id": "0000rnvpf3m1f3nf4k40",
"errors": [
{
"code": "parameter_invalid",
"message": "Your name for this attribute must only contain alphanumeric characters, currency symbols, and hyphens"
}
]
}
HTTP/1.1 400 BAD REQUEST
{
"type": "error.list",
"request_id": "0000rnvpf3m1f3nf4k40",
"errors": [
{
"code": "parameter_invalid",
"message": "'Name' is one of our standard attributes for your people data. To save this as new people data, use a different name."
}
]
}
HTTP/1.1 400 BAD REQUEST
{
"type": "error.list",
"request_id": "0000rnvpf3m1f3nf4k40",
"errors": [
{
"code": "parameter_invalid",
"message": "Data Type isn't an option"
}
]
}
HTTP/1.1 400 BAD REQUEST
{
"type": "error.list",
"request_id": "0000rnvpf3m1f3nf4k40",
"errors": [
{
"code": "parameter_invalid",
"message": "You must have at least two options on a list type data attribute"
}
]
}
You can create a data attributes for a contact
or a company
.
Request Body Parameters
Attribute | Type | Description |
---|---|---|
name | string | The name of the attribute. |
model | string | The model where the attribute applies to. Accepts contact or company . |
data_type | string | The type of data stored for this attribute. Accepted values are string , integer , float , boolean , date . |
description | string | (Optional) The readable description you see in the UI for the attribute. |
options | array | (Optional) To create list attributes. Provide a set of hashes with value as the key of the options you want to make. data_type must be string . |
messenger_writable | boolean | (Optional). When set to false , the attribute will not be writable by the Messenger. Default value is true . |
Response
This will return a Data Attribute Model showing the details of your created attribute.