@memberjunction/actions-bizapps-crm
Version:
CRM system integration actions for MemberJunction
84 lines • 3.1 kB
TypeScript
import { ActionParam } from '@memberjunction/actions-base';
import { BaseAction } from '@memberjunction/actions';
import { UserInfo } from '@memberjunction/core';
import { CompanyIntegrationEntity } from '@memberjunction/core-entities';
/**
* Base class for all CRM-related actions.
* Provides common functionality and patterns for interacting with Customer Relationship Management systems.
*/
export declare abstract class BaseCRMAction extends BaseAction {
/**
* The CRM provider this action is designed for (e.g., 'HubSpot', 'Salesforce', etc.)
*/
protected abstract crmProvider: string;
/**
* The integration name to look up in the Integration entity
*/
protected abstract integrationName: string;
/**
* Cached company integration for the current execution
*/
private _companyIntegration;
/**
* Common CRM parameters that many actions will need
*/
protected getCommonCRMParams(): ActionParam[];
/**
* Gets the company integration record for the specified company and CRM
*/
protected getCompanyIntegration(companyId: string, contextUser: UserInfo): Promise<CompanyIntegrationEntity>;
/**
* Gets credentials from environment variables
* Format: BIZAPPS_{PROVIDER}_{COMPANY_ID}_{CREDENTIAL_TYPE}
* Example: BIZAPPS_HUBSPOT_12345_API_KEY
*/
protected getCredentialFromEnv(companyId: string, credentialType: string): string | undefined;
/**
* Gets API credentials - first tries environment variables, then falls back to database
*/
protected getAPICredentials(integration: CompanyIntegrationEntity): Promise<{
apiKey?: string;
apiSecret?: string;
accessToken?: string;
refreshToken?: string;
clientId?: string;
clientSecret?: string;
}>;
/**
* Gets the base URL for API calls
*/
protected getAPIBaseURL(integration: CompanyIntegrationEntity): Promise<string>;
/**
* Helper to get parameter value with type safety
*/
protected getParamValue(params: ActionParam[], paramName: string): any;
/**
* Standard date format for CRM systems (ISO 8601)
*/
protected formatCRMDate(date: Date): string;
/**
* Parse date from CRM format
*/
protected parseCRMDate(dateString: string): Date;
/**
* Format phone numbers to E.164 format if possible
*/
protected formatPhoneNumber(phone: string): string;
/**
* Validate email format
*/
protected isValidEmail(email: string): boolean;
/**
* Helper to build consistent error messages for CRM operations
*/
protected buildCRMErrorMessage(operation: string, details: string, systemError?: any): string;
/**
* Map deal/opportunity stages to common statuses
*/
protected mapDealStatus(stage: string): 'open' | 'won' | 'lost' | 'unknown';
/**
* Common activity types mapping
*/
protected mapActivityType(type: string): 'call' | 'email' | 'meeting' | 'task' | 'note' | 'other';
}
//# sourceMappingURL=base-crm.action.d.ts.map