UNPKG

@onereach/channel-transformer

Version:

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

16 lines (13 loc) 515 B
import { IGenericSection } from "../../../generic/types"; import { ISMSMessage } from "../../types"; import { getMethods } from "../methods"; export const transformMessage = (message: ISMSMessage): IGenericSection => { const section: IGenericSection = { type: 'section', children: [] }; const { medias = []} = message?.media; if (medias.length) section.children.push(getMethods('attachments')(medias)); section.children.push(getMethods('text')(message.text)); return section; };