# @onereach/channel-transformer

> Convert data model between different channels (Slack, Microsoft Teams, Generic...)

Latest version **0.0.65** (published 2025-11-04) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @onereach/channel-transformer
pnpm add @onereach/channel-transformer
yarn add @onereach/channel-transformer
bun add @onereach/channel-transformer
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.65 |
| Published | 2025-11-04 |
| First published | 2020-09-21 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=16.0.0 |
| Dependencies | 7 |
| Unpacked size | 2 MB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Author | Oleg Zdendiak |
| Maintainers | onereach.admin, onereach.user |
| Keywords | onereach, channel, transform, blockkit |

## Links

- npm: https://www.npmjs.com/package/@onereach/channel-transformer
- npm.io page: https://npm.io/package/@onereach/channel-transformer

## Dependencies (7)

- [uuid](https://npm.io/package/uuid.md) ^11.1.0
- [showdown](https://npm.io/package/showdown.md) ^1.9.1
- [turndown](https://npm.io/package/turndown.md) ^7.1.1
- [node-emoji](https://npm.io/package/node-emoji.md) ^1.11.0
- [html-escaper](https://npm.io/package/html-escaper.md) ^3.0.3
- [turndown-plugin-gfm](https://npm.io/package/turndown-plugin-gfm.md) ^1.0.2
- [turndown-performance-fixed](https://npm.io/package/turndown-performance-fixed.md) ^6.0.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.65 (latest) — 2025-11-04
- 0.0.66-patchversion98.0 (beta) — 2025-11-04
- 0.0.65-salesforcemiawlinks96.0 — 2025-10-31
- 0.0.65-salesforcemiawlinks95.0 — 2025-10-31
- 0.0.64 — 2025-07-17
- 0.0.65-salesforcemiaw93.0 — 2025-07-14
- 0.0.65-salesforcemiaw92.0 — 2025-07-11
- 0.0.65-salesforcemiaw91.0 — 2025-07-11
- 0.0.65-salesforcemiaw90.0 — 2025-07-11
- 0.0.63 — 2024-08-06
- 0.0.63-nicecxone86.0 — 2024-08-06
- 0.0.63-nicecxone84.0 — 2024-08-06
- 0.0.63-nicecxone83.0 — 2024-08-05
- 0.0.63-rwcv682.0 — 2024-08-05
- 0.0.62 — 2024-02-22
- … 75 more at https://npm.io/package/@onereach/channel-transformer/versions

## README

## 🚜 Transformer between differend data model channels

Channles: 
- Generic model
- Skack Block kit model

## Installing: 

*We use TypeScript, and all types are described, full documentation you can find*: https://onereach.gitlab.io/platform/transform-channels/index.html

> In Browser using unpkg:
```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Channel transfromer. Browser + UNPKG</title>
</head>
<body>
  <script src="https://unpkg.com/@onereach/channel-transformer@latest/dist/channel-transformer.umd.min.js"></script>
  <script>
    var slackDataModel = {
      "blocks": [
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": "This is a mrkdwn section block :ghost: *this is bold*, and ~this is crossed out~, and <https://google.com|this is a link>"
          }
        }
      ]
    }

    // Transform Slack data model to Generic model
    var genericModel = channelTransformer.transformSlackToGeneric(slackDataModel);

    // Transfrom back from Generic model to Slack data model
    var slackModel = channelTransformer.transformGenericToSlack(genericModel);

    console.log(genericModel, slackModel);
  </script>
</body>
</html>
```

> ES6
```zsh
  npm i @onereach/channel-transformer
```

```javascript
import {
  transformSlackToGeneric,
  transformGenericToSlack
} from '@onereach/channel-transformer';
```

> Node.js
```zsh
  npm i @onereach/channel-transformer
```

```javascript
const {
  transformSlackToGeneric,
  transformGenericToSlack
} = require('@onereach/channel-transformer');

const slackDataModel = {
	"blocks": [
		{
			"type": "section",
			"text": {
				"type": "mrkdwn",
				"text": "This is a mrkdwn section block :ghost: *this is bold*, and ~this is crossed out~, and <https://google.com|this is a link>"
			}
		}
	]
}



// Transform Slack data model to Generic model
const genericModel = transformSlackToGeneric(slackDataModel);

// Transfrom back from Generic model to Slack data model
const slackModel = transformGenericToSlack(genericModel);

console.log(genericModel, slackModel);
```

Developing:
✅ Tests for Slack -> Generic -> Slack
✅ Export types
✅ Can be imported in any js env
- Microsoft Teams channel
- Zoom channel

## How it works
Sample: Microsoft Teams and Slack

- Microsoft Teams Adaptive Cards data model 👉 transform to default data model 👉 transform from default data model to Slack Block kit data model
- Slack Block kit data model 👉 transform to default data model 👉 transform from default data model to Microsoft Teams Adaptive Cards data model


## Generic data model schema based on rule:
All data soted in Array of Object.
Each object have three required and only possible properties: 
1) type - type is unic name of field
2) props - all settings, states and so on of field
3) children - Array of Objects dependent elements

Sample: 
```javascript
[
  {
    type: 'section',
    props: {
      variableName: '...',
      column: 2,
      value: ''
    },
    children: []
  },
  {
    type: 'input',
    props: {
      value: '',
      required: true
    },
    children: []
  }
]
```

Small html app for transfroming data from Slack to Genric > https://content-assets.onereach.ai/apps/channel-transformer-app/0.0.3/index.html

## How to add new channels?
Before runnning dev mode install latest node.js and nvm then use command ```nvm use```
1) Create new brnach
2) Copy structure of anu channel (Slack, Web) in ```./src/channels```
3) Export main functions to ```./src/```
4) Create script in package.json, take for example already created channels

## How to test
1) Slack -> Generic -> Slack. Command ```npm run test:slack```

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