@connection-hub/sdk
Version:
SDK oficial para a API do Connection Hub
88 lines (87 loc) • 1.99 kB
TypeScript
interface ConnectionHubConfig {
apiUrl?: string;
accessToken: string;
}
type ConnectionHubClientType = any;
interface BaseService {
checkCredentials?(): void;
}
interface ConnectionData {
pageId: string;
pageName: string;
pageAccessToken: string;
clientBackURL: string;
clientFrontURL: string;
type: "facebook" | "instagram" | "email" | "mercadolivre";
active: boolean;
emailUser?: string;
emailPassword?: string;
emailImapHost?: string;
emailImapPort?: number;
emailImapTls?: boolean;
emailSmtpHost?: string;
emailSmtpPort?: number;
emailSmtpTls?: boolean;
accessToken?: string;
channelToken?: string;
}
interface MessageData {
mid: string;
from: {
id: string;
name?: string;
email?: string;
};
to: {
id: string;
name?: string;
email?: string;
};
timestamp?: number;
message?: {
mid?: string;
text?: string;
subject?: string;
html?: string;
textAsHtml?: string;
references?: string[];
attachments?: Array<{
type: string;
payload: {
url?: string;
filename?: string;
mime_type?: string;
size?: number;
content?: string;
};
}>;
};
source: "facebook" | "instagram" | "email" | "telegram" | "mercadolivre" | string;
}
interface WebhookPayload {
pageId: string;
connectionId?: string;
messageData: MessageData[];
metadata?: {
platform: string;
accountName?: string;
externalThreadId?: string;
clientId?: string;
};
}
interface AuthResponse {
success: boolean;
token?: string;
error?: string;
}
interface SendMessageResponse {
success: boolean;
messageId?: string;
error?: string;
}
interface AttachmentInstagram {
type: string;
payload: {
url: string;
};
}