Created
November 13, 2020 10:22
-
-
Save ashwanth1109/2bf401ed26d29269e200a2a76e2d7b61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.env.AWS_SDK_LOAD_CONFIG = "true"; | |
process.env.AWS_PROFILE = "volt"; | |
import * as AWS from "aws-sdk"; | |
var credentials = new AWS.SharedIniFileCredentials({ profile: "volt" }); | |
AWS.config.credentials = credentials; | |
const connect = new AWS.Connect(); | |
const content = JSON.stringify({ | |
Version: "2019-10-30", | |
StartAction: "Play prompt identifier", | |
Metadata: { | |
EntryPointPosition: { | |
X: 88, | |
Y: 100, | |
}, | |
ActionMetadata: { | |
"Play prompt identifier": { | |
Position: { | |
X: 270, | |
Y: 98, | |
}, | |
}, | |
"Disconnect identifier": { | |
Position: { | |
X: 545, | |
Y: 92, | |
}, | |
}, | |
}, | |
}, | |
Actions: [ | |
{ | |
Identifier: "Play prompt identifier", | |
Type: "MessageParticipant", | |
Transitions: { | |
NextAction: "Disconnect identifier", | |
Errors: [], | |
Conditions: [], | |
}, | |
Parameters: { | |
Text: "Thanks for calling the sample flow!", | |
}, | |
}, | |
{ | |
Identifier: "Disconnect identifier", | |
Type: "DisconnectParticipant", | |
Transitions: {}, | |
Parameters: {}, | |
}, | |
], | |
}); | |
const params: AWS.Connect.CreateContactFlowRequest = { | |
Content: content, | |
InstanceId: "6d788d2b-c543-41fc-8e19-dc01792da877", | |
Name: "TestFromSDK", | |
Type: "CONTACT_FLOW", | |
}; | |
connect.createContactFlow(params, (err, data) => { | |
if (err) console.log(err, err.stack); | |
// an error occurred | |
else console.log(data); // successful response | |
}); | |
// const listParams: AWS.Connect.ListContactFlowsRequest = { | |
// InstanceId: "6d788d2b-c543-41fc-8e19-dc01792da877", | |
// }; | |
// | |
// connect.listContactFlows(listParams, (err, data) => { | |
// if (err) console.log(err, err.stack); | |
// // an error occurred | |
// else console.log(data); // successful response | |
// }); | |
// const test = { | |
// modules: [ | |
// { | |
// id: "5a530aea-f4d6-437c-bf95-4f4faec303dc", | |
// type: "Disconnect", | |
// branches: [], | |
// parameters: [], | |
// metadata: { position: { x: 775, y: 104 } }, | |
// }, | |
// { | |
// id: "9005473f-a693-41be-bf8f-d710a75ed99f", | |
// type: "PlayPrompt", | |
// branches: [ | |
// { | |
// condition: "Success", | |
// transition: "5a530aea-f4d6-437c-bf95-4f4faec303dc", | |
// }, | |
// ], | |
// parameters: [ | |
// { | |
// name: "AudioPrompt", | |
// value: | |
// "arn:aws:connect:us-east-1:250464340741:instance/6d788d2b-c543-41fc-8e19-dc01792da877/prompt/78811414-5e04-4909-ad9b-989c04aaf451", | |
// namespace: null, | |
// resourceName: "vdna-ash-test1.wav", | |
// }, | |
// ], | |
// metadata: { | |
// position: { x: 349, y: 137 }, | |
// useDynamic: false, | |
// promptName: "vdna-ash-test1.wav", | |
// }, | |
// }, | |
// ], | |
// version: "1", | |
// type: "contactFlow", | |
// start: "9005473f-a693-41be-bf8f-d710a75ed99f", | |
// metadata: { | |
// entryPointPosition: { x: 43, y: 80 }, | |
// snapToGrid: false, | |
// name: "AshTest", | |
// description: null, | |
// type: "contactFlow", | |
// status: "published", | |
// hash: "bb923a7b3e2b6ac66d99401d5d08fadbeed23275bd3e6abfa6885e16b22dc8b1", | |
// }, | |
// }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment