UNPKG

@onereach/channel-transformer

Version:

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

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