curl --request POST \
--url https://app.yampi.ai/api/v1/accounts/{account_id}/custom_attribute_definitions \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"attribute_display_name": "Custom Attribute",
"attribute_display_type": 0,
"attribute_description": "This is a custom attribute",
"attribute_key": "custom_attribute",
"attribute_values": [
"value1",
"value2"
],
"attribute_model": 0,
"regex_pattern": "^[a-zA-Z0-9]+$",
"regex_cue": "Please enter a valid value"
}
'const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
attribute_display_name: 'Custom Attribute',
attribute_display_type: 0,
attribute_description: 'This is a custom attribute',
attribute_key: 'custom_attribute',
attribute_values: ['value1', 'value2'],
attribute_model: 0,
regex_pattern: '^[a-zA-Z0-9]+$',
regex_cue: 'Please enter a valid value'
})
};
fetch('https://app.yampi.ai/api/v1/accounts/{account_id}/custom_attribute_definitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.yampi.ai/api/v1/accounts/{account_id}/custom_attribute_definitions"
payload = {
"attribute_display_name": "Custom Attribute",
"attribute_display_type": 0,
"attribute_description": "This is a custom attribute",
"attribute_key": "custom_attribute",
"attribute_values": ["value1", "value2"],
"attribute_model": 0,
"regex_pattern": "^[a-zA-Z0-9]+$",
"regex_cue": "Please enter a valid value"
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": 123,
"attribute_display_name": "<string>",
"attribute_display_type": "<string>",
"attribute_description": "<string>",
"attribute_key": "<string>",
"regex_pattern": "<string>",
"regex_cue": "<string>",
"attribute_values": "<string>",
"attribute_model": "<string>",
"default_value": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Add a new custom attribute
Add a new custom attribute to account
curl --request POST \
--url https://app.yampi.ai/api/v1/accounts/{account_id}/custom_attribute_definitions \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"attribute_display_name": "Custom Attribute",
"attribute_display_type": 0,
"attribute_description": "This is a custom attribute",
"attribute_key": "custom_attribute",
"attribute_values": [
"value1",
"value2"
],
"attribute_model": 0,
"regex_pattern": "^[a-zA-Z0-9]+$",
"regex_cue": "Please enter a valid value"
}
'const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
attribute_display_name: 'Custom Attribute',
attribute_display_type: 0,
attribute_description: 'This is a custom attribute',
attribute_key: 'custom_attribute',
attribute_values: ['value1', 'value2'],
attribute_model: 0,
regex_pattern: '^[a-zA-Z0-9]+$',
regex_cue: 'Please enter a valid value'
})
};
fetch('https://app.yampi.ai/api/v1/accounts/{account_id}/custom_attribute_definitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://app.yampi.ai/api/v1/accounts/{account_id}/custom_attribute_definitions"
payload = {
"attribute_display_name": "Custom Attribute",
"attribute_display_type": 0,
"attribute_description": "This is a custom attribute",
"attribute_key": "custom_attribute",
"attribute_values": ["value1", "value2"],
"attribute_model": 0,
"regex_pattern": "^[a-zA-Z0-9]+$",
"regex_cue": "Please enter a valid value"
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": 123,
"attribute_display_name": "<string>",
"attribute_display_type": "<string>",
"attribute_description": "<string>",
"attribute_key": "<string>",
"regex_pattern": "<string>",
"regex_cue": "<string>",
"attribute_values": "<string>",
"attribute_model": "<string>",
"default_value": "<string>",
"created_at": "<string>",
"updated_at": "<string>"
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Authorizations
Token de usuario. Envía el valor en el header api_access_token. Lo obtienes en el perfil (GET /api/v1/profile) o al regenerarlo.
Path Parameters
The numeric ID of the account
Body
Attribute display name
"Custom Attribute"
Attribute display type (text- 0, number- 1, currency- 2, percent- 3, link- 4, date- 5, list- 6, checkbox- 7)
0
Attribute description
"This is a custom attribute"
Attribute unique key value
"custom_attribute"
Attribute values
["value1", "value2"]
Attribute type(conversation_attribute- 0, contact_attribute- 1)
0
Regex pattern (Only applicable for type- text). The regex pattern is used to validate the attribute value(s).
"^[a-zA-Z0-9]+$"
Regex cue message (Only applicable for type- text). The cue message is shown when the regex pattern is not matched.
"Please enter a valid value"
Response
Success
Identifier
Attribute display name
Attribute display type (text, number, currency, percent, link, date, list, checkbox)
Attribute description
Attribute unique key value
Regex pattern
Regex cue
Attribute values
Attribute type(conversation_attribute/contact_attribute)
Attribute default value
The date and time when the custom attribute was created
The date and time when the custom attribute was updated