Custom Attributes
Use the Custom Attributes API to apply customizable data or characteristics to each of your subscribers. You can then build segments based on that information to send targeted campaigns and journeys.
Set Custom Attributes
Use the setCustomAttributes
mutation for any attribute-based data for a user. There are no limits to the amount of custom attributes that can be created. Note that you can create net-new properties with this API, however, it cannot be used to create new values for an existing UI-created property name. If a property name is created through the Attentive platform, all possible property values must also be defined in the platform.
The following input fields are provided:
properties
- Required. Any metadata associated with the attribute. Object keys and values are expected to be strings. Both object keys and object values are case sensitive. "Favorite color" and "Favorite Color" would be considered different custom attributes.
user
- Required. User associated with the action. Note that this is a visitor to the site and does not need to be actively subscribed to Attentive.
Example Mutation
Make sure to set the Authorization: Bearer <Unique API Key>
on the request. For more information about obtaining a unique API Key please see the Authentication Docs
POST https://api.attentivemobile.com/v1/graphql
mutation setCustom($customAttributesInput: SetCustomAttributesInput!) {
setCustomAttributes(input: $customAttributesInput) {
properties
user {
email
phone
externalIdentifiers {
clientUserId
customIdentifiers {
name
value
}
}
}
}
}
Example Input Variable
{
"customAttributesInput": {
"properties": "{ \"customKey\":\"customValue\" }",
"user": {
"email": "test@gmail.com",
"phone": "+13115552368",
"externalIdentifiers": {
"clientUserId": "c60b3f4e-ec73-4ff0-be4b-6a0fce825e89",
"customIdentifiers": [
{
"name": "customIdentifierName",
"value": "customIdentifierValue"
}
]
}
}
}
}
Example Response
{
"data": {
"setCustomAttributes": {
"properties": "{ \"customKey\":\"customValue\" }",
"user": {
"email": "test@gmail.com",
"phone": "+13115552368",
"externalIdentifiers": {
"clientUserId": "c60b3f4e-ec73-4ff0-be4b-6a0fce825e89",
"customIdentifiers": [
{
"name": "customIdentifierName",
"value": "customIdentifierValue"
}
]
}
}
}
},
"extensions": {
"traceId": "00000"
}
}