Retrieve attributes in your application
Calculated attribute values are stored in the Profiles Store and consumed by your applications via the Python SDK, Node.js SDK, or API.
Start by connecting to Signals to create a Signals client object.
Use a service
The preferred way to retrieve attributes is via a service, which lets you fetch attributes from multiple groups in one call. See Services to define one using the Console or Python SDK.
- Python
- Node.js
Use get_service_attributes() to retrieve attributes from a service.
calculated_values = sp_signals.get_service_attributes(
name="my_service",
attribute_key="domain_userid",
identifier="218e8926-3858-431d-b2ed-66da03a1cbe5",
)
| Argument | Description | Type | Required? |
|---|---|---|---|
name | The name of the service | string | ✅ |
attribute_key | The attribute key to retrieve attributes for | string | ✅ |
identifier | The specific attribute key value | string | ✅ |
Use getServiceAttributes() to retrieve attributes for a single identifier, or getBatchServiceAttributes() for multiple identifiers in one call.
const calculatedValues = await signals.getServiceAttributes({
name: "my_service",
attribute_key: "domain_userid",
identifier: "218e8926-3858-431d-b2ed-66da03a1cbe5",
});
| Argument | Description | Type | Required? |
|---|---|---|---|
name | The name of the service | string | ✅ |
attribute_key | The attribute key to retrieve attributes for | string | ✅ |
identifier | The specific attribute key value | string | ✅ |
const batchResults = await signals.getBatchServiceAttributes({
name: "shopping_cart_service",
attribute_key: "domain_userid",
identifiers: [
"218e8926-3858-431d-b2ed-66da03a1cbe5",
"f47ac10b-58cc-4372-a567-0e02b2c3d479",
"6ba7b810-9dad-11d1-80b4-00c04fd430c8"
]
});
| Argument | Description | Type | Required? |
|---|---|---|---|
name | The name of the service | string | ✅ |
attribute_key | The attribute key to retrieve attributes for | string | ✅ |
identifiers | Array of attribute key values to look up | string[] | ✅ |
Retrieve individual attributes
You can also retrieve attributes directly from a specific attribute group, without a service. This is useful when you want a small subset of attributes or haven't defined a service yet.
- Python
- Node.js
Use get_group_attributes() to retrieve specific attributes.
calculated_values = sp_signals.get_group_attributes(
name="my_attribute_group",
version=1,
attributes=["page_view_count"],
attribute_key="domain_userid",
identifier="218e8926-3858-431d-b2ed-66da03a1cbe5",
)
| Argument | Description | Type | Required? |
|---|---|---|---|
name | The name of the attribute group | string | ✅ |
version | The attribute group version | int | ✅ |
attributes | The names of the attributes to retrieve | string or list of string | ✅ |
attribute_key | The attribute key name | string | ✅ |
identifier | The specific attribute key value | string | ✅ |
Use getGroupAttributes() to retrieve specific attributes from an attribute group.
const calculatedValues = await signals.getGroupAttributes({
name: "my_attribute_group",
version: 1,
attributes: ["page_view_count"],
attribute_key: "domain_userid",
identifier: "218e8926-3858-431d-b2ed-66da03a1cbe5",
});
| Argument | Description | Type | Required? |
|---|---|---|---|
name | The name of the attribute group | string | ✅ |
version | The attribute group version | number | ✅ |
attributes | The names of the attributes to retrieve | string[] | ✅ |
attribute_key | The attribute key name | string | ✅ |
identifier | The specific attribute key value | string | ✅ |