import { BaseConnector } from '../../base/base.connector'; import type { ChatSendResult, IChatConnector, IChatOptions, IChatProvider, ISendMessageSuccessResponse, WithPassthrough } from '../../types'; import { ChannelTypeEnum } from '../../types'; import type { RocketChatConfig } from './rocket-chat.config'; import type { RocketChatNarrowedInput } from './rocket-chat.types'; /** * Webhook-URL-as-auth: the webhook URL itself is the credential. * * Rocket.Chat Incoming Webhooks accept Slack-compatible JSON; the webhook URL * itself is the credential (no `X-Auth-Token` / `X-User-Id` headers). The * webhook returns `{ success: true }` JSON on success — no `message_id` is * surfaced, so `providerMessageId` is always `null`. * * The camelCase→snake_case mapping for Slack-compat attachment fields lives in * the private `toWireAttachment` method below (explicit * per-connector mapping, NOT generic middleware). */ export declare class RocketChatChatConnector extends BaseConnector implements IChatConnector, IChatProvider { private readonly config; readonly id: "rocket-chat"; readonly channelType: ChannelTypeEnum.CHAT; constructor(config: RocketChatConfig, fetchImpl?: typeof fetch); /** * Thinwrap-native send. Implements `IChatConnector`. * * `to` is intentionally absent from `RocketChatNarrowedInput` — the webhook * URL targets the (default) channel directly. Snake_case wire keys * inside attachments (`author_name`, `author_link`, `author_icon`, * `title_link`, `image_url`, `thumb_url`) are written explicitly * no `Casing` helper is invoked. Top-level Rocket.Chat fields * (`alias`, `avatar`, `emoji`, `channel`, `tmid`, `tshow`) are already * Rocket.Chat-wire-native and pass through verbatim. */ send(input: RocketChatNarrowedInput): Promise; /** * Shared by `.send()` and `sendMessage()`, so a Novu `options.webhookUrl` * override gets the same presence + https checks and redaction as the * configured URL. */ private postToWebhook; /** * Map camelCase narrowed attachment fields to Slack-compat snake_case wire * keys. Lives on the connector (NOT a shared utility): * explicit per-connector mapping for the Slack-compat-attachment-shape * contract this connector owns. * * Same-form fields (`color`, `pretext`, `title`, `text`, `fields`, `footer`, * `timestamp`, `fallback`) pass through untouched. Unknown extension keys * are preserved verbatim via the `[k: string]: unknown` index signature. */ private toWireAttachment; /** * HTTP-layer mapping. ConnectorError carries no * `retryAfterSeconds` field — retry is consumer policy: * parsed seconds embedded in `providerMessage` text, raw header preserved on * `cause.retryAfter`. Wrapper performs no retry. * * 401/403/404 all map to `auth_failed` — invalid, disabled, or * deleted Incoming Webhook URLs are all credential failures. */ private mapVendorError; sendMessage(options: IChatOptions, bridgeProviderData?: WithPassthrough>): Promise; }