competitive

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package competitive provides a competitive intelligence provider for omnisignal.

This provider ingests win/loss data and competitive gap signals from CRM systems (Salesforce, HubSpot) and competitive intelligence platforms.

Usage:

import (
    "github.com/plexusone/omnisignal"
    _ "github.com/plexusone/omnisignal/provider/competitive"
)

provider, err := omnisignal.New("competitive", omnisignal.Config{
    Options: map[string]any{
        "source": "salesforce",
    },
})

Index

Constants

View Source
const (
	SourceSalesforce = "salesforce"
	SourceHubSpot    = "hubspot"
	SourceClari      = "clari"
	SourceGong       = "gong"
	SourceCustom     = "custom"
)

Source identifiers for CRM and competitive intelligence systems.

View Source
const (
	// ProviderName is the identifier for this provider.
	ProviderName = "competitive"
)

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(cfg omnisignal.Config) (omnisignal.Provider, error)

NewProvider creates a new competitive intelligence provider.

Types

type Adapter

type Adapter interface {
	// FetchDeals retrieves win/loss records.
	FetchDeals(ctx context.Context, opts omnisignal.FetchOptions) ([]DealRecord, error)

	// FetchGaps retrieves competitive gap signals.
	FetchGaps(ctx context.Context, opts omnisignal.FetchOptions) ([]CompetitiveGap, error)

	// Source returns the adapter's source identifier.
	Source() string
}

Adapter converts competitive data to signals.

type CompetitiveGap

type CompetitiveGap struct {
	// ID is the unique identifier.
	ID string

	// Title describes the gap.
	Title string

	// Description provides detail about the gap.
	Description string

	// Competitor is the competitor with the advantage.
	Competitor string

	// Capability is the specific feature or capability lacking.
	Capability string

	// Impact describes business impact (e.g., "lost 3 deals worth $500K").
	Impact string

	// Severity indicates how critical the gap is.
	Severity common.Severity

	// Market is the MarketSpec market slug.
	Market string

	// DealIDs links to related deal records.
	DealIDs []string

	// IdentifiedAt is when the gap was identified.
	IdentifiedAt time.Time

	// Source is where this gap was identified.
	Source string

	// Metadata contains additional fields.
	Metadata map[string]any
}

CompetitiveGap represents a capability gap identified through competitive analysis.

type DealRecord

type DealRecord struct {
	// ID is the unique identifier for this record.
	ID string

	// OpportunityID is the CRM opportunity identifier.
	OpportunityID string

	// AccountName is the customer/prospect name.
	AccountName string

	// AccountRef is the MarketSpec customer ref (e.g., "customer:acme-001").
	AccountRef string

	// Outcome is win or loss.
	Outcome Outcome

	// Competitors are the competitors involved in the deal.
	Competitors []string

	// PrimaryCompetitor is the main competitor (for losses, who won).
	PrimaryCompetitor string

	// Reasons are the factors that led to the outcome.
	Reasons []string

	// DealValue is the opportunity amount in cents.
	DealValue int64

	// Market is the MarketSpec market slug.
	Market string

	// ClosedAt is when the deal closed.
	ClosedAt time.Time

	// Source is the CRM system.
	Source string

	// Metadata contains additional source-specific fields.
	Metadata map[string]any
}

DealRecord represents a win/loss record from CRM.

type MemoryAdapter

type MemoryAdapter struct {
	// contains filtered or unexported fields
}

MemoryAdapter is an in-memory adapter for testing.

func NewMemoryAdapter

func NewMemoryAdapter(source string) *MemoryAdapter

NewMemoryAdapter creates an in-memory adapter.

func (*MemoryAdapter) AddDeal

func (m *MemoryAdapter) AddDeal(d DealRecord)

AddDeal adds a deal record.

func (*MemoryAdapter) AddGap

func (m *MemoryAdapter) AddGap(g CompetitiveGap)

AddGap adds a competitive gap.

func (*MemoryAdapter) Clear

func (m *MemoryAdapter) Clear()

Clear removes all records.

func (*MemoryAdapter) FetchDeals

func (m *MemoryAdapter) FetchDeals(ctx context.Context, opts omnisignal.FetchOptions) ([]DealRecord, error)

FetchDeals retrieves deal records from memory.

func (*MemoryAdapter) FetchGaps

FetchGaps retrieves competitive gaps from memory.

func (*MemoryAdapter) Source

func (m *MemoryAdapter) Source() string

Source returns the adapter's source identifier.

type Outcome

type Outcome string

Outcome represents the result of a competitive deal.

const (
	OutcomeWin  Outcome = "win"
	OutcomeLoss Outcome = "loss"
)

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements omnisignal.Provider for competitive intelligence.

func (*Provider) Capabilities

func (p *Provider) Capabilities() omnisignal.Capabilities

Capabilities returns what this provider supports.

func (*Provider) Close

func (p *Provider) Close() error

Close releases any resources held by the provider.

func (*Provider) Fetch

func (p *Provider) Fetch(ctx context.Context, opts omnisignal.FetchOptions) ([]signal.Signal, error)

Fetch retrieves competitive signals (both deals and gaps).

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider identifier.

func (*Provider) Subscribe

func (p *Provider) Subscribe(ctx context.Context, opts omnisignal.SubscribeOptions) (<-chan signal.Signal, error)

Subscribe is not supported for competitive intelligence.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL