Hi, I want to create InboundMessageFlow and I want to add CallBotConnector node in the flow.
Please help me how to create using Architect Flow SDK Please help me how to create using Architect Flow
wanted to create a flow like this
Hi, I want to create InboundMessageFlow and I want to add CallBotConnector node in the flow.
Please help me how to create using Architect Flow SDK Please help me how to create using Architect Flow
wanted to create a flow like this
I think ArchFactoryActions#addActionCallBotConnector this function is not yet implemented in architect scripting SDk, if implemented please let me know how to use this function.
Yes it's implemented.
var startupState = archFlow.startUpObject;
var botConnectorVar = actionFactory.addActionCallBotConnector(startupState, 'Calling bot connector bot');
botConnectorVar.setBotByIdAsync('insertBotIntegrationIdHere', 'insertBotIdHere', 'insertBotVersionHere', function(bcbAsync){//everything from here until the }); is optional and depends on how your bot is configured.
//I'm just showing how to set the various fields with dummy values
botConnectorVar.inputText.setExpression('Message.Message.body');
botConnectorVar.followupResponseTimeout.setExpression('MakeDuration(0, 12, 0, 0, 0)');
botConnectorVar.addSessionVariableNameValuePair('input1', '"the 1st thing"');
botConnectorVar.addSessionVariableOutputNameValuePair('output2', 'State.output2');
var intentOneVar = botConnectorVar.intentSlots.getNamedValueByName('IntentOne');
intentOneVar.getNamedValueByName('One').value.setVariable('State.intent1');
botConnectorVar.botConnectorOutputsFailure.getNamedValueByName('errorType').value.setVariable('Flow.errorType');
var disconnectVar = actionFactory.addActionDisconnect(botConnectorVar.getOutputByName('IntentOne', true), 'Disconnect');});
Hi Melissa,
Thanks for the reply.
I am trying the below code.
// --------------------------------------------------------------------------------
// Require in the Genesys Cloud Platform SDK and Architect Scripting SDK
// --------------------------------------------------------------------------------
const architectScripting = require('purecloud-flow-scripting-api-sdk-javascript');
const platformApi = require('purecloud-platform-client-v2');
const scriptingActionFactory = architectScripting.factories.archFactoryActions; // Factory to create actions
const scriptingEnums = architectScripting.enums.archEnums; // Enum support
const scriptingFlowFactory = architectScripting.factories.archFactoryFlows; // Factory to create flows
const scriptingLanguages = architectScripting.languages.archLanguages; // Language support
const scriptingSession = architectScripting.environment.archSession; // Session support
const scriptingTaskFactory = architectScripting.factories.archFactoryTasks; // Factory to create tasks
const scriptingLogger = architectScripting.services.archLogging;
// const callBotConnector = architectScripting.viewModels.actions.ArchActionCallBotConnector;
// --------------------------------------------------------------------------------
// See above in the readme for information on creating a client id / secret.
// We will use these when starting the Architect Scripting session.
// --------------------------------------------------------------------------------
const clientId = '';
const clientSecret = '';
const clientIsClientCredentials = true; // set to false if using an OAuth client
// that has a code authorization grant
// instead of client credentials grant.
// --------------------------------------------------------------------------------
// Helpers to make sample code more readable.
// --------------------------------------------------------------------------------
const archEnums = architectScripting.enums.archEnums;
const archSession = architectScripting.environment.archSession;
const platformApiClient = platformApi.ApiClient.instance;
// --------------------------------------------------------------------------------
// This function will be what is called by Architect Scripting since it is
// specified in the start call at the bottom.
// --------------------------------------------------------------------------------
function doWork(scriptSession) {
// Once the session starts you can do this to assign the authToken from
// the Architect session object to the platform API client.
platformApiClient.setAccessToken(scriptSession.authToken);
var startupState = scriptingFlowFactory.startUpObject;
var botConnectorVar = scriptingActionFactory.addActionCallBotConnector(startupState, 'Calling bot connector bot');
botConnectorVar.setBotByIdAsync('insertBotIntegrationIdHere', 'insertBotIdHere', 'insertBotVersionHere', function(bcbAsync){
//everything from here until the }); is optional and depends on how your bot is configured.
//I'm just showing how to set the various fields with dummy values
botConnectorVar.inputText.setExpression('Message.Message.body');
botConnectorVar.followupResponseTimeout.setExpression('MakeDuration(0, 12, 0, 0, 0)');
botConnectorVar.addSessionVariableNameValuePair('input1', '"the 1st thing"');
botConnectorVar.addSessionVariableOutputNameValuePair('output2', 'State.output2');
var intentOneVar = botConnectorVar.intentSlots.getNamedValueByName('IntentOne');
intentOneVar.getNamedValueByName('One').value.setVariable('State.intent1');
botConnectorVar.botConnectorOutputsFailure.getNamedValueByName('errorType').value.setVariable('Flow.errorType');
var disconnectVar = scriptingActionFactory.addActionDisconnect(botConnectorVar.getOutputByName('IntentOne', true), 'Disconnect');
});
// return scriptingFlowFactory.createFlowInboundShortMessageAsync("TestFlow-Bhagi", "TestFlow", scriptingLanguages.englishUnitedStates, (data)=>{
// console.log("=================================");
// console.log(scriptingFlowFactory);
// console.log("=================================");
// });
}
// This will start off the Architect Scripting code and call the doWork function
archSession.startWithClientIdAndSecret(archEnums.LOCATIONS.prod_us_east_1, doWork, clientId, clientSecret, void 0, clientIsClientCredentials);
// archSession.startWithAuthToken(archEnums.LOCATIONS.prod_us_east_1, doWork, authToken, void 0, clientIsClientCredentials);
getting the below error
Hi Melissa,
Yes, I am using the latest version of npm library.
"purecloud-flow-scripting-api-sdk-javascript": "^0.36.1"
Hi, I am able to achieve the above flow, and got one more issue,
Can we add a transfer to ACD to the "talk to agent" intent from the above flow?
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.