# tcchatsdk

> tcchatsdk

Latest version **0.0.4** (published 2024-06-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install tcchatsdk
pnpm add tcchatsdk
yarn add tcchatsdk
bun add tcchatsdk
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2024-06-01 |
| First published | 2023-07-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | zouzhiqiang |
| Maintainers | zzq984521432 |

## Links

- npm: https://www.npmjs.com/package/tcchatsdk
- npm.io page: https://npm.io/package/tcchatsdk

## Recent versions

- 0.0.4 (latest) — 2024-06-01
- 0.0.3 — 2023-07-07
- 0.0.2 — 2023-07-07
- 0.0.1 — 2023-07-07
- 1.0.0 — 2023-07-07

## README

# chat-tool
> chat-tool bridge 

# usage

```js
import { sdk } from 'tcchatsdk'
sdk.getWorkInfo() // Promise<WorkInfo>
```

```ts

getWorkInfo(): Promise<WorkInfo>;
/**
 * 获取客户信息
 * @returns {Promise<CustomerInfo>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getCustomerInfo().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getCustomerInfo(): Promise<CustomerInfo>;
/**
 * 获取会话信息
 * @returns {Promise<ChatInfo>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getChatInfo().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getChatInfo(): Promise<ChatInfo>;
/**
 * 获取账号信息
 * @returns {Promise<AccountInfo>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getAccountInfo().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getAccountInfo(): Promise<AccountInfo>;
/**
 * 获取会话工具状态
 * @returns {Promise<{ isOnline: boolean }>}
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.getChatToolStatus().then(res => {
 *   console.log(res)
 * })
 * ```
 */
getChatToolStatus(): Promise<{
    isOnline: boolean;
}>;
/**
 * 发送文本消息
 * @param text 文本
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendText('hello world')
 * ```
 */
sendText(text: string): Promise<Record<string, unknown>>;
/**
 * 发送图片消息
 * @param options 图片信息
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendImage({
 *   fileName: '图片名称',
 *   picUrl: '图片地址'
 * })
 * ```
 */
sendImage(options: {
    fileName: string;
    picUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 发送链接消息
 * @param options 链接信息
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendLink({
 *   title: '链接标题',
 *   description: '链接描述',
 *   link: '链接地址',
 *   imageUrl: '链接图片地址'
 * })
 * ```
 */
sendLink(options: {
    title: string;
    description: string;
    link: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 发送小程序消息
 * @param options 小程序数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendMiniProgram({
 *   title: '小程序标题',
 *   appId: '小程序appId',
 *   appName: '小程序名称',
 *   wxUsername: '小程序原始id',
 *   pagePath: '小程序页面路径',
 *   imageUrl: '小程序图片地址'
 * })
 * ```
 */
sendMiniProgram(options: {
    title: string;
    appId: string;
    appName: string;
    wxUsername: string;
    pagePath: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 发送视频消息
 * @param options 视频数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.sendVideo({
 *   videoName: '视频名称',
 *   videoThumbImageUrl: '视频缩略图地址',
 *   videoUrl: '视频地址'
 * })
 * ```
 */
sendVideo(options: {
    videoName: string;
    videoThumbImageUrl: string;
    videoUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入图片
 * @param url 图片地址
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertImg('图片地址')
 * ```
 */
insertImg(url: string): Promise<Record<string, unknown>>;
/**
 * 插入视频
 * @param options 视频数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertVideo({
 *   url: '视频地址',
 *   videoUrl: '视频缩略图地址'
 * })
 * ```
 */
insertVideo(options: {
    url: string;
    videoUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入艾特消息
 * @param options 艾特消息数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertAt({
 *   label: '艾特消息',
 *   id: 123
 * })
 * ```
 */
insertAt(options: {
    label: string;
    id: number;
}): Promise<Record<string, unknown>>;
/**
 * 插入小程序
 * @param options 小程序数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertProgram({
 *   title: '小程序标题',
 *   appId: '小程序appId',
 *   appName: '小程序名称',
 *   wxUsername: '小程序原始id',
 *   pagePath: '小程序页面路径',
 *   imageUrl: '小程序图片地址'
 * })
 * ```
 */
insertProgram(options: {
    title: string;
    appId: string;
    appName: string;
    wxUsername: string;
    pagePath: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入链接
 * @param options 链接数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertLink({
 *   title: '链接标题',
 *   description: '链接描述',
 *   link: '链接地址',
 *   imageUrl: '链接图片地址'
 * })
 * ```
 */
insertLink(options: {
    title: string;
    description: string;
    link: string;
    imageUrl: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入文件链接
 * @param options 文件链接数据
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertFileLink({
 *   title: '文件链接标题',
 *   description: '文件链接描述',
 *   link: '文件链接地址'
 * })
 * ```
 */
insertFileLink(options: {
    title: string;
    description: string;
    link: string;
}): Promise<Record<string, unknown>>;
/**
 * 插入文本
 * @param text 文本
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.insertText('文本')
 * ```
 */
insertText(text: string): Promise<Record<string, unknown>>;
/**
 * 显示商品卡片
 * @param target 目标元素，用于定位商品卡片
 * @param speechId 商品id
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.showProductCard(123)
 * ```
 */
showProductSpeech(target: HTMLElement, speechId: string | number): void | Promise<Record<string, unknown>>;
/**
 * 打开新窗口
 * @param url 地址
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.openWindow('https://www.baidu.com')
 * ```
 */
openWindow(url: string): Promise<Record<string, unknown>>;
/**
 * 打开webview弹窗
 * @param url 地址
 * @returns
 * @memberof SDK
 * @example
 * ```ts
 * chatSdk.openWebView('https://www.baidu.com')
 * ```
 */
openWebView(url: string): Promise<Record<string, unknown>>;
```

---
_Source: https://npm.io/package/tcchatsdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
