Voiceflow PartnersVPVoiceflow Partners
Powered by
UmairPerwaizU
Voiceflow Partners•8mo ago•
3 replies
UmairPerwaiz

In the javascript node I am getting the error

PLease understand the below code :

function encodeMimeMessageAsBase64Url(mimeContent) {
// Ensure Buffer is available in your execution environment.
// In Voiceflow's JavaScript steps, Buffer might not be available directly.
// You might need to use browser-compatible methods like btoa and TextEncoder if this causes issues.
const base64url = Buffer.from(mimeContent)
.toString('base64')
.replace(/+/g, '-') // Convert '+' to '-'
.replace(///g, '') // Convert '/' to ''
.replace(/=+$/, ''); // Remove trailing '='

return base64url;
}

// --- Example Usage ---

// Compose MIME text email manually
mimeMessage =
Content-Type: text/plain; charset="utf-8"
To: umairperwaizmalik1@gmail.com
From: cxboltagency@gmail.com
Subject: Test Subject

Hello Umair, this is a test email from Voiceflow!
Content-Type: text/plain; charset="utf-8"
To: umairperwaizmalik1@gmail.com
From: cxboltagency@gmail.com
Subject: Test Subject

Hello Umair, this is a test email from Voiceflow!
;

// Encode message using the new function
rawMessage = encodeMimeMessageAsBase64Url(mimeMessage);

// In Voiceflow, you would typically assign 'rawMessage' to a variable
// that you've defined in your step, for example:
//
_.set('rawMessageVariable', rawMessage);
_.set('rawMessageVariable', rawMessage);
if using
_
_
for state management,
// or simply if
rawMessage
rawMessage
is an output variable of your JavaScript step.

console.log(rawMessage); // For testing outside Voiceflow to see the output



Task:
Please help me resolve the error
Voiceflow Partners banner
Voiceflow PartnersJoin
Exclusive community for Voiceflow Solutions Providers & Content Creators.
13,076Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?
Recent Announcements
jacklyn

# Let your agents search the web 🔎 Hey everyone! We just released the web search tool for the agent step! Your agents can now automatically search the web for information, letting your agent supplement the LLM's knowledge and the data in its knowledge base with live, up-to-date information. Plus.... * You can restrict searches to specific domains, so your agent only searches sites that you own * This is a tool, so you remain in control of when the agent searches the web * Results are automatically summarized in a way that your agent can automatically understand Under the hood, we're using OpenAI's web search API. Give it a try, and let us know what you think! https://docs.voiceflow.com/changelog/native-web-search-tool

jacklyn · 4mo ago

jacklyn

jacklynbiggin's Thread

jacklyn · 4mo ago

hurt-tomato

connor_maclean's Thread

hurt-tomato · 4mo ago

Similar Threads

JavaScript card error
ill-bronzeIill-bronze / ❓┃ask-a-question
3y ago
Can I use setTimeout() in a Javascript Step?
instant-harlequinIinstant-harlequin / ❓┃ask-a-question
3y ago
JavaScript
colossal-harlequinCcolossal-harlequin / ❓┃ask-a-question
2y ago
For the pro Javascript users - help?
nursing-limeNnursing-lime / ❓┃ask-a-question
3y ago