Overview of Code Actions
Execute custom code that is hosted on the Flow platform. Code actions are JavaScript that runs in a sandboxed environment and allows you to easily customize and extend Flow capabilities.
Limited execution time
When using cloud code the code execution or a call to a service must be done within 10 seconds.
Quick examples
Send text
async payload => {
const text = new Text(`This is a reply text from your bot.`)
const message = new Message(`This is a reply text from your bot as a fallback text.`)
message.addResponse(text)
return message
}
Send text with quick replies
async payload => {
const text = new Text(`This is a reply text from your bot.`)
text.addQuickReply(new QuickReply({ label: 'Again', value: 'Get started' }))
const message = new Message(`This is a reply text from your bot as a fallback text.`)
message.addResponse(text)
return message
}
Sending an email
async payload => {
toolbelt.email({
to: '[email protected]',
subject: 'This is the subject of you email.',
message: 'Compose the body of your email here.'
})
}
Trigger a flow
Within Code, you can choose to either reply directly with messages or trigger different flows.
async payload => {
trigger('EVENT')
}
Updated 12 months ago
What’s Next
Read more on Code Actions: