Skip to main content

The Official Python SDK for the B2Brilliant Campaign Agent API

Project description

B2B Campaign Agent Python SDK

A Python client for the B2B Campaign Agent API that helps you generate personalized B2B campaigns by analyzing business websites and social media profiles.

Want to Join The Beta?

Visit here to register for beta access!

Installation

pip install b2brilliant-sdk

Basic Usage

from b2brilliant_sdk import B2BrilliantAgent

# Initialize with your API key
agent = B2BrilliantAgent(api_key="your-api-key")

# Discover information about your business
user_business = agent.user.discover([
    "https://yourbusiness.com"
])

# Discover information about a target business
target_business = agent.business.discover([
    "https://targetbusiness.com"
])

# Generate campaigns (email, DM, SMS)
campaigns = agent.campaigns.create(
    user_business,
    target_business,
    ["email", "dm", "sms"]
)

# Use the generated campaigns
print(campaigns)

API Reference

Initialization

from b2brilliant_sdk import B2BrilliantAgent

agent = B2BrilliantAgent(api_key="your-api-key")

User Business Methods

Discover User Business Information

options = {
    "find_competitors": True,
    "find_branding": True,
    "deep_search": False
}

user_business = agent.user.discover(
    ["https://yourbusiness.com", "https://yourbusiness.com/about"],
    options
)

Refine User Business Information

refined_business = agent.user.refine(
    user_business, 
    "We recently launched a new service called 'Advanced Analytics'"
)

Target Business Methods

Discover Target Business Information

target_business = agent.business.discover(
    ["https://targetbusiness.com"],
    {"find_branding": True}
)

Refine Target Business Information

refined_target = agent.business.refine(
    target_business,
    "They recently announced a Series B funding round"
)

Assess Business Compatibility

compatibility = agent.business.compatibility(
    user_business,
    target_business
)

print(f"Compatibility score: {compatibility['score']}")
print("Positives:", compatibility["reasoning"]["positives"])
print("Negatives:", compatibility["reasoning"]["negatives"])
print("Recommendations:", compatibility["reasoning"]["recommendations"])

Campaign Methods

Create Campaign

# Generate all campaign types
all_campaigns = agent.campaigns.create(
    user_business,
    target_business
)

# Generate only specific campaign types
campaign_types = ["email", "dm"]
specific_campaigns = agent.campaigns.create(
    user_business,
    target_business,
    campaign_types
)

Refine Campaign

refined_campaigns = agent.campaigns.refine(
    user_business,
    target_business,
    all_campaigns,
    "Make the tone more professional and focus on their recent funding"
)

Error Handling

The SDK raises typed exceptions that can be caught and handled:

from b2brilliant_sdk.exceptions import ApiError, ValidationError

try:
    campaigns = agent.campaigns.create(user_business, target_business)
except ApiError as e:
    print(f"API error ({e.status}): {e.message}")
    print("Error data:", e.data)
except ValidationError as e:
    print("Validation error:", e.validation_errors)
except Exception as e:
    print("Unexpected error:", e)

Data Structures

The SDK works with the following key data structures:

BusinessObject

{
    "profile": {
        "name": str,
        "summary": str,
        "services": List[str],
        "current_events": str,
        "target_audience": str,
        "industry": str
    },
    "contacts": {
        "point_of_contact": {  # Optional
            "name": str,
            "position": str
        },
        "social": List[Dict],  # List of social channels
        "email": str,
        "phone": str
    },
    "branding": {
        "voice": str,
        "tone": str,
        "style": str,
        "phrases": List[str]
    },
    "competitors": List[Dict],  # Optional
    "confidence": {
        "score": float,  # 0-10
        "reasoning": str
    }
}

CampaignObject

{
    "target_business": str,
    "user_business": str,
    "campaigns": [
        {
            "type": str,  # "dm", "email", or "sms"
            "content": str,
            "rating": float,
            "feedback": {
                "strengths": List[str],
                "weaknesses": List[str],
                "suggestions": List[str]
            }
        }
    ]
}

BusinessCompatibilityScore

{
    "target_business": str,
    "user_business": str,
    "score": float,
    "reasoning": {
        "positives": List[str],
        "negatives": List[str],
        "recommendations": List[str]
    }
}

License

This software is licensed under the Business Source License 1.1 (BSL).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

b2brilliant_sdk-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

b2brilliant_sdk-0.1.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file b2brilliant_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: b2brilliant_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for b2brilliant_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39433532eb01fd76b434a6f1da9976d65513e4cd9da764d3eee5529ca329485d
MD5 0d6767c41c9d31b5d0fe88b37b254226
BLAKE2b-256 5e5ecd3af50af98eee90dab928e93636fd3ec3dbb51c099682bb873cbf1878cc

See more details on using hashes here.

File details

Details for the file b2brilliant_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for b2brilliant_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a22cb097e3ed614560c7012796f154b608c9a0f4f5c235f8ffdaf16cdf675af0
MD5 d4ec9cb019fb601e443148109eda0459
BLAKE2b-256 1cd5212411590e9cd7011210376c505e84d2f7f46db9d059aa132dfa6f31d71f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page