Scripting With Archy on Windows
Let's get started with a demonstration of how to use Archy within a batch file. Below you can find an example batch file, with the corresponding options files and flow YAML that is used.
Please note that the example YAML file that is defined on this page may not work if you do not have the same Data Action and Screen Pop Script configured within your organization. This is just an example and the flow that is used can be replaced with a different flow.
Batch file
Copied
ECHO OFF
REM Created 2020-06-30
REM Demo batch file to show how to create a flow, check in a flow, and check exit codes.
echo Create a flow.
REM Calling archy to create the flow specified within the options file.
REM This assumes that the createOptions.yaml file is found in the 'C:\demo\' directory.
call archy create --optionsFile C:\demo\createOptions.yaml
REM Checking if the exit code from Archy is greater than or equal to 2 to determine
REM if the flow was created successfully.
if %ERRORLEVEL% GEQ 2 echo Error. Did not create the flow.
echo Check in a flow.
REM Calling archy here to check in a flow.
REM This assumes that the checkinOptions.yaml file is found within the 'C:\demo\ directory.
call archy checkin --optionsFile C:\demo\checkinOptions.yaml
REM Exit code 110 means: Unable to complete the command because the flow is locked to another entity.
REM Some commands have parameters such as --forceUnlock which will tell Archy to try and unlock the current flow lock.
REM A list of exit codes can be found at https://developer.mypurecloud.com/devapps/archy/appendices/appendix_a_exit_codes.html
REM This doesn't cover all exit codes, but shows how to check for one.
if %ERRORLEVEL% == 110 echo Failed to checkin the flow because it is locked.
createOptions.yaml
Copied
###########################################################################
# Example options file showing how to set settings when running commands. #
# Properties here map to command line parameters. #
# When specifying file paths, we encourage you to use a full resolved #
# file path instead of relative file paths. #
###########################################################################
clientId: xxx # Replace with your clientId
clientSecret: xxx # Replace with your clientSecret
debug: false
location: mypurecloud.com # If needed, replace with the correct environment you wish to run Archy against
# Archy 'create' command-specific parameters
file: C:\demo\demoCallDataFlow.yaml
recreate: true
# resultsFile tells Archy to create a JSON file with information about results of the Archy command
# More information can be found at https://developer.mypurecloud.com/devapps/archy/resultsOutputJson.html
resultsFile: C:\demo\createResults.json
overwriteResultsFile: true
# Substitutions that are used when processing the flow YAML
substitutions:
org_name: Demo Architect Org
checkinOptions.yaml
Copied
###########################################################################
# Example options file showing how to set settings when running commands. #
# Properties here map to command line parameters. #
# When specifying file paths, we encourage you to use a full resolved #
# file path instead of relative file paths. #
###########################################################################
clientId: xxx # Replace with your clientId
clientSecret: xxx # Replace with your clientSecret
debug: false
location: mypurecloud.com # If needed, replace with the correct environment you wish to run Archy against
# Archy 'checkin' command-specific parameters
flowName: Archy Hello World
flowType: inboundcall
# resultsFile tells Archy to create a JSON file with information about results of the Archy command
# More information can be found at https://developer.mypurecloud.com/devapps/archy/resultsOutputJson.html
resultsFile: C:\demo\checkinResults.json
overwriteResultsFile: true
Example YAML file
Copied
inboundCall:
name: Demo Inbound Support
defaultLanguage: en-us
startUpRef: /inboundCall/tasks/task[startingTask]
initialGreeting:
tts: "Welcome to {{org_name}}."
tasks:
- task:
name: Starting Task
refId: startingTask
actions:
- decision:
name: Is Call.Ani a telephone number?
condition:
exp: ToPhoneNumber(Call.Ani).isTel
outputs:
yes:
actions:
- callData:
name: My Call Data Action
category:
Salesforce Data Actions:
dataAction:
Get Account By Phone Number:
inputs:
PHONE_NUMBER:
exp: ToPhoneNumber(Call.Ani).e164
successOutputs:
Name:
var: Task.customerName
AccountNumber:
var: Task.accountNumber
outputs:
success:
actions:
- setScreenPop:
name: Set Screen Pop Action
screenPopScript:
Caller Account Info Pop:
inputs:
AccountNumber:
exp: Task.accountNumber
Customer Name:
exp: Task.customerName
- transferToAcd:
name: Transfer to Support
targetQueue:
lit:
name: Support
preTransferAudio:
tts: Now transferring your call to support
failureTransferAudio:
tts: Sorry, please call back later.
- disconnect:
name: Disconnect
Archy - Ver. 2.33.1, generated on January 3, 2025