Skip to main content

Examples

Common patterns for integrating with Subscriberbot.

List active relationships

CLI

subscriberbot subscriberbot relationships list --status ACTIVE

Node SDK

const relationships = await sdk.subscriberbot.relationships.list({
filter: { status: 'ACTIVE' },
});

Python SDK

relationships = await sdk.subscriberbot.relationships.list(filter={"status": "ACTIVE"})

GraphQL

query {
subListRelationships(filter: { status: ACTIVE }) {
id
provider { name }
plan { name price interval }
renewalDate
healthScore
}
}

Create a provider

CLI

subscriberbot subscriberbot providers create \
--name "Acme Inc" \
--category SAAS \
--description "Project management tool"

Node SDK

const provider = await sdk.subscriberbot.providers.create({
name: 'Acme Inc',
category: 'SAAS',
description: 'Project management tool',
});

Python SDK

provider = await sdk.subscriberbot.providers.create({
"name": "Acme Inc",
"category": "SAAS",
"description": "Project management tool",
})

GraphQL

mutation {
subCreateProvider(input: {
name: "Acme Inc"
category: SAAS
description: "Project management tool"
}) {
id
name
}
}

Cancel a relationship

CLI

subscriberbot subscriberbot relationships cancel <id> --reason UNUSED

Node SDK

await sdk.subscriberbot.relationships.cancel({
id: 'rel_123',
reason: 'UNUSED',
});

Python SDK

await sdk.subscriberbot.relationships.cancel(id="rel_123", reason="UNUSED")

GraphQL

mutation {
subCancelRelationship(id: "rel_123", reason: UNUSED) {
id
status
effectiveDate
}
}

Ingest an inbox message

CLI

subscriberbot subscriberbot inbox ingest \
--channel-id <id> \
--subject "Invoice from Acme" \
--body "Your monthly invoice..."

GraphQL

mutation {
subIngestMessage(input: {
channelId: "ch_123"
subject: "Invoice from Acme"
body: "Your monthly invoice..."
category: BILLING
}) {
id
summary
}
}

Check health

CLI

subscriberbot health check

Node SDK

const health = await sdk.health.check();

Python SDK

health = await sdk.health.check()

GraphQL

query {
subHealth
}
Environment selection

All examples target production by default. Set BURDENOFF_ENV=local|alpha before running CLI commands, or pass explicit endpoints to the SDKs. See Environment Selection for endpoint details.