@onereach/channel-transformer
Version:
Convert data model between different channels (Slack, Microsoft Teams, Generic...)
17 lines (14 loc) • 627 B
text/typescript
import { ISalesforceMiawMessage } from "../../types";
import { IGenericSection } from "../../../generic/types";
import { getMethods } from "../methods";
export const transformDynamicsMessage = (message: ISalesforceMiawMessage): IGenericSection => {
const section: IGenericSection = {
type: 'section',
children: []
};
if (message?.staticContent?.text) section.children.push(getMethods("text")(message?.staticContent));
if (message?.staticContent?.attachments?.length) {
section.children.push(getMethods("attachments")(message?.staticContent?.attachments));
}
return section;
};