UNPKG

@onereach/channel-transformer

Version:

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

13 lines (9 loc) 442 B
import { IGenericAttachments } from "../../../generic/types"; import { ISMSMessage } from "../../types"; export const transformFileUpload = ({ props }: IGenericAttachments): ISMSMessage => { const attachments = props?.value?.staticValue || props?.value?.filesValue; return attachments.reduce((acc, attachment) => { acc.media.medias.push({linkURL: attachment.text}); return acc; }, { media: { medias: [] }}); };