UNPKG

@onereach/channel-transformer

Version:

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

15 lines (12 loc) 547 B
import { IMSDynamicsMessage } from "../../types"; import { IGenericSection } from "../../../generic/types"; import { getMethods } from "../methods"; export const transformDynamicsMessage = (message: IMSDynamicsMessage): IGenericSection => { const section: IGenericSection = { type: 'section', children: [] }; if (message?.content) section.children.push(getMethods("text")(message?.content)); if (message?.attachments) section.children.push(getMethods("attachments")(message?.attachments)); return section; };