Dev Guide
Dev GuideUser GuideGitHubNuGetDevCommunitySubmit a ticketLog In
GitHubNuGetDevCommunitySubmit a ticket

ODP Node SDK / z

z

Const object

{
    configure: (newConfig: null | InternalConfig | Config) => void;
    customer: (payload: CustomerPayload | CustomerPayload[], opts?: PayloadOptions) => Promise<HttpResponse<CustomerResponse>>;
    event: (payload: EventPayload | EventPayload[]) => Promise<HttpResponse<EventResponse>>;
    graphql: <T>(query: string, variables?: {}) => Promise<GqlHttpResponse<T>>;
    identifier: {
        getConsent: (identifierName: string, identifierValue: string) => Promise<HttpResponse<GetConsentResponse>>;
        getMetadata: (identifierFieldName: string, identifierValue: string) => Promise<HttpResponse<IdentifierMetadataResponse>>;
        getReachability: (identifierName: string, value: string) => Promise<HttpResponse<GetReachabilityResponse>>;
        updateConsent: (updates: ConsentUpdate | ConsentUpdate[]) => Promise<HttpResponse<V3SuccessResponse>>;
        updateMetadata: (updates: IdentifierMetadata | IdentifierMetadata[]) => Promise<HttpResponse<V3SuccessResponse>>;
        updateReachability: (updates: ReachabilityUpdate | ReachabilityUpdate[]) => Promise<HttpResponse<V3SuccessResponse>>;
    };
    list: {
        createList: (listName: string) => Promise<HttpResponse<CreateListResponse>>;
        getLists: () => Promise<HttpResponse<GetListsResponse>>;
        subscribe: (listId: string, identifiers: Identifiers | Identifiers[]) => Promise<HttpResponse<ListUpdateResponse>>;
        unsubscribe: (listId: string, identifiers: Identifiers | Identifiers[]) => Promise<HttpResponse<ListUpdateResponse>>;
        updateSubscriptions: (listId: string, updates: ListUpdateRequest[]) => Promise<HttpResponse<ListUpdateResponse>>;
    };
    object: (type: string, payload: ObjectPayload | ObjectPayload[], opts?: PayloadOptions) => Promise<HttpResponse<ObjectResponse>>;
    schema: {
        ApiFieldExistsError: typeof ApiFieldExistsError;
        ApiIdentifierExistsError: typeof ApiIdentifierExistsError;
        ApiObjectExistsError: typeof ApiObjectExistsError;
        ApiRelationExistsError: typeof ApiRelationExistsError;
        ApiSchemaValidationError: typeof ApiSchemaValidationError;
        createField: (object: string, field: FieldDefinition) => Promise<HttpResponse<FieldDefinition>>;
        createIdentifier: (identifier: IdentifierDefinition) => Promise<HttpResponse<CreateIdentifierResponse>>;
        createObject: (object: ObjectDefinition) => Promise<HttpResponse<ObjectDefinition>>;
        createRelation: (object: string, relation: RelationDefinition) => Promise<HttpResponse<RelationDefinition>>;
        enableModule: (module: string) => Promise<HttpResponse<ModulesResponse>>;
        getAllObjects: () => Promise<HttpResponse<ObjectDefinition[]>>;
        getEnabledModules: () => Promise<HttpResponse<ModulesResponse>>;
        getObject: (name: string) => Promise<HttpResponse<ObjectDefinition>>;
    };
    v3Api: typeof ApiV3;
}

The preferred export for utilizing the Zaius Node SDK.

Usage


import {z} from '@zaiusinc/node-sdk';

// Send an event to Zaius
await z.event(...);
// Subscribe a customer by an identifier to a list
await z.list.subscribe(...);
// etc

Type declaration

MemberTypeDescription
configure(newConfig: null | InternalConfig | Config) => voidExposed method to set the configuration options
This handled automatically in a Zaius Integration Platform App
usage z.configure({...})
customer(payload: CustomerPayload | CustomerPayload[], opts?: PayloadOptions) => Promise<HttpResponse<CustomerResponse>>Send a customer or a batch of customers to Zaius.

Throws

if it receives a non-2XX result or if the batch size is > BATCH_LIMIT
event(payload: EventPayload | EventPayload[]) => Promise<HttpResponse<EventResponse>>Send an event or a batch of events to Zaius

Throws

if it receives a non-2XX result or if the batch size is > BATCH_LIMIT
graphql<T>(query: string, variables?: {}) => Promise<GqlHttpResponse<T>>Queries the GraphQL API.

Throws

if it receives a non-2XX result
identifierobject-
identifier.getConsent(identifierName: string, identifierValue: string) => Promise<HttpResponse<GetConsentResponse>>Get consent information about an identifier

Throws

if it receives any non-2XX result
identifier.getMetadata(identifierFieldName: string, identifierValue: string) => Promise<HttpResponse<IdentifierMetadataResponse>>Get metadata for a customer's identifier

Throws

if it receives any non-2XX result
identifier.getReachability(identifierName: string, value: string) => Promise<HttpResponse<GetReachabilityResponse>>Get reachability information about an identifier
identifier.updateConsent(updates: ConsentUpdate | ConsentUpdate[]) => Promise<HttpResponse<V3SuccessResponse>>Update consent of a messaging identifier

Throws

if it receives any non-2XX result
identifier.updateMetadata(updates: IdentifierMetadata | IdentifierMetadata[]) => Promise<HttpResponse<V3SuccessResponse>>Update metadata for a customer's identifier

Throws

if it receives any non-2XX result
identifier.updateReachability(updates: ReachabilityUpdate | ReachabilityUpdate[]) => Promise<HttpResponse<V3SuccessResponse>>Update reachability of a messaging identifier

Throws

if it receives any non-2XX result
listobject-
list.createList(listName: string) => Promise<HttpResponse<CreateListResponse>>Create a Zaius marketing list. If the list already exists, you will receive a 400.

Throws

if it receives any non-2XX result
list.getLists() => Promise<HttpResponse<GetListsResponse>>Get all Zaius marketing lists for the current account

Throws

if it receives any non-2XX result
list.subscribe(listId: string, identifiers: Identifiers | Identifiers[]) => Promise<HttpResponse<ListUpdateResponse>>Subscribe a customer or array of customers to a list

Throws

if it receives a non-2XX result or if the batch size is > BATCH_LIMIT
list.unsubscribe(listId: string, identifiers: Identifiers | Identifiers[]) => Promise<HttpResponse<ListUpdateResponse>>Unsubscribe a customer or array of customers from a list

Throws

if it receives a non-2XX result or if the batch size is > BATCH_LIMIT
list.updateSubscriptions(listId: string, updates: ListUpdateRequest[]) => Promise<HttpResponse<ListUpdateResponse>>Bulk update subscriptions for multiple customers to a list (or multiple lists).

Throws

if it receives a non-2XX result or if the batch size is > BATCH_LIMIT
object(type: string, payload: ObjectPayload | ObjectPayload[], opts?: PayloadOptions) => Promise<HttpResponse<ObjectResponse>>Send an object or a batch of objects to Zaius

Throws

if it receives a non-2XX result or if the batch size is > BATCH_LIMIT
schemaobject-
schema.ApiFieldExistsErrortypeof ApiFieldExistsError-
schema.ApiIdentifierExistsErrortypeof ApiIdentifierExistsError-
schema.ApiObjectExistsErrortypeof ApiObjectExistsError-
schema.ApiRelationExistsErrortypeof ApiRelationExistsError-
schema.ApiSchemaValidationErrortypeof ApiSchemaValidationError-
schema.createField(object: string, field: FieldDefinition) => Promise<HttpResponse<FieldDefinition>>Create a custom field on a Zaius object

Throws

if the field name already exists

Throws

if it receives any other non-2XX result
schema.createIdentifier(identifier: IdentifierDefinition) => Promise<HttpResponse<CreateIdentifierResponse>>Create a customer identifier

Throws

if the identifier already exists

Throws

if it receives any other non-2XX result
schema.createObject(object: ObjectDefinition) => Promise<HttpResponse<ObjectDefinition>>Create a custom Zaius object

Throws

if the object name already exists

Throws

if it receives any other non-2XX result
schema.createRelation(object: string, relation: RelationDefinition) => Promise<HttpResponse<RelationDefinition>>Create a custom Zaius relation between two objects

Throws

if the relation name is already in use by another field or relation

Throws

if it receives any other non-2XX result
schema.enableModule(module: string) => Promise<HttpResponse<ModulesResponse>>Enables a schema module.

Throws

if the module was already enabled

Throws

if it receives any other non-2XX result
schema.getAllObjects() => Promise<HttpResponse<ObjectDefinition[]>>Gets the definitions of all Zaius objects.

Throws

if it receives a non-2XX result
schema.getEnabledModules() => Promise<HttpResponse<ModulesResponse>>Gets the list of enabled schema modules.

Throws

if it receives a non-2XX result
schema.getObject(name: string) => Promise<HttpResponse<ObjectDefinition>>Gets the definition of a Zaius object.

Throws

if there is no object with the given name

Throws

if it receives any other non-2XX result
v3Apitypeof ApiV3Direct access to query any API by path using the v3 API helper

Defined in: src/Api/index.ts:26