MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / sendWorkspaceInvite

Function sendWorkspaceInvite

packages/server/src/enterprise/utils/sendEmail.ts:66–97  ·  view source on GitHub ↗
(
    email: string,
    workspaceName: string,
    registerLink: string,
    platform: Platform = Platform.ENTERPRISE,
    inviteType: 'new' | 'update' = 'new'
)

Source from the content-addressed store, hash-verified

64}
65
66const sendWorkspaceInvite = async (
67 email: string,
68 workspaceName: string,
69 registerLink: string,
70 platform: Platform = Platform.ENTERPRISE,
71 inviteType: 'new' | 'update' = 'new'
72) => {
73 let htmlToSend
74 let textContent
75
76 const template =
77 platform === Platform.ENTERPRISE
78 ? getEmailTemplate(
79 inviteType === 'new' ? 'workspace_new_invite_enterprise.hbs' : 'workspace_update_invite_enterprise.hbs',
80 process.env.WORKSPACE_INVITE_TEMPLATE_PATH
81 )
82 : getEmailTemplate(
83 inviteType === 'new' ? 'workspace_new_invite_cloud.hbs' : 'workspace_update_invite_cloud.hbs',
84 process.env.WORKSPACE_INVITE_TEMPLATE_PATH
85 )
86 const compiledWorkspaceInviteTemplateSource = handlebars.compile(template)
87 htmlToSend = compiledWorkspaceInviteTemplateSource({ workspaceName, registerLink })
88 textContent = `You have been invited to ${workspaceName}. Click here to register: ${registerLink}` // plain text body
89
90 await transporter.sendMail({
91 from: SENDER_EMAIL || '"FlowiseAI Team" <team@mail.flowiseai.com>', // sender address
92 to: email,
93 subject: `You have been invited to ${workspaceName}`, // Subject line
94 text: textContent, // plain text body
95 html: htmlToSend // html body
96 })
97}
98
99const sendPasswordResetEmail = async (email: string, resetLink: string) => {
100 const passwordResetTemplateSource = fs.readFileSync(path.join(__dirname, '../', 'emails', 'workspace_user_reset_password.hbs'), 'utf8')

Callers 1

saveInviteAccountMethod · 0.90

Calls 1

getEmailTemplateFunction · 0.85

Tested by

no test coverage detected