Variables in code follow the pattern
variabletype.variablename.variabletype.variablename.workflow.orderNumber = 12345
conversation.cartTotal = 59.99
user.lastName = 'Smith'
bot.version = '1.2.3'
env.databaseURL = 'https://example.com/db'
if (user.firstName === 'John') {
console.log('Hello John!')
} else {
console.log('Welcome, user!')
}
function greetUser(firstName) {
console.log('Hello, ' + firstName + '!')
}
greetUser(user.firstName)
var fullName = user.firstName + ' ' + user.lastName
// or
var welcomeMessage = 'Hello, ' + user.firstName + ' ' + user.lastName + '!'
if (typeof workflow.userAcctId === 'number') {
workflow.userAcctId = 67890
} else {
console.error('Invalid type for userAcctId!')
}
const apiKey = env.API_KEY
const apiUrl = env.API_URL
const config = {
headers: {
Authorization: `Bearer ${apiKey}`,
},
}
const response = await axios.get(apiUrl, config)
const data = response.data
// Process the data as needed
// ...
// Example: Log the response data
console.log(data)
``` |
Was this page helpful?