Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion bin/deploy-runner.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genesys-cloud-architect",
"version": "1.0.2",
"version": "1.0.3",
"private": true,
"packageManager": "pnpm@11.1.3+sha512.c85357fe17ca12dd23dd7071822666dfd7e3cb76fe214e3370b5ea2fb34f2a231185509b63e717f3cd0acb38dd3f8d82bcd5e8172400ae678b70ea4fbed0896d",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions servers/genesys-cloud-architect-mcp.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions skills/write-flow/references/examples/inbound-call.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Simple IVR with a welcome message, main menu with 3 choices, and queue transfers
```typescript
import type { ArchitectScripting } from "purecloud-flow-scripting-api-sdk-javascript";

export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
export async function buildFlow(scripting: ArchitectScripting) {
const { archFactoryFlows, archFactoryActions, archFactoryMenus } = scripting.factories;

const flow = await archFactoryFlows.createFlowInboundCallAsync(
Expand Down Expand Up @@ -40,6 +40,6 @@ export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
const jumpToMenu = archFactoryActions.addActionJumpToMenu(initialState.outputSequence);
jumpToMenu.targetMenu = mainMenu;

await flow.checkInAsync();
return await flow.checkInAsync();
}
```
4 changes: 2 additions & 2 deletions skills/write-flow/references/examples/inbound-chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Chat flow with a greeting message and queue transfer.
```typescript
import type { ArchitectScripting } from "purecloud-flow-scripting-api-sdk-javascript";

export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
export async function buildFlow(scripting: ArchitectScripting) {
const { archFactoryFlows, archFactoryActions } = scripting.factories;

const flow = await archFactoryFlows.createFlowInboundChatAsync(
Expand All @@ -25,6 +25,6 @@ export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
const transfer = archFactoryActions.addActionTransferToAcd(initialState);
await transfer.setQueueByName("Chat Support Queue");

await flow.checkInAsync();
return await flow.checkInAsync();
}
```
4 changes: 2 additions & 2 deletions skills/write-flow/references/examples/inbound-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Email flow with auto-reply and queue transfer.
```typescript
import type { ArchitectScripting } from "purecloud-flow-scripting-api-sdk-javascript";

export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
export async function buildFlow(scripting: ArchitectScripting) {
const { archFactoryFlows, archFactoryActions } = scripting.factories;

const flow = await archFactoryFlows.createFlowInboundEmailAsync(
Expand All @@ -28,6 +28,6 @@ export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
const transfer = archFactoryActions.addActionTransferToAcd(sequence);
await transfer.setQueueByName("Email Support Queue");

await flow.checkInAsync();
return await flow.checkInAsync();
}
```
4 changes: 2 additions & 2 deletions skills/write-flow/references/examples/inbound-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SMS/messaging flow with auto-reply and queue transfer.
```typescript
import type { ArchitectScripting } from "purecloud-flow-scripting-api-sdk-javascript";

export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
export async function buildFlow(scripting: ArchitectScripting) {
const { archFactoryFlows, archFactoryActions } = scripting.factories;

const flow = await archFactoryFlows.createFlowInboundShortMessageAsync(
Expand All @@ -25,6 +25,6 @@ export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
const transfer = archFactoryActions.addActionTransferToAcd(initialState);
await transfer.setQueueByName("SMS Support Queue");

await flow.checkInAsync();
return await flow.checkInAsync();
}
```
4 changes: 2 additions & 2 deletions skills/write-flow/references/examples/workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Automated workflow that creates a callback request.
```typescript
import type { ArchitectScripting } from "purecloud-flow-scripting-api-sdk-javascript";

export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
export async function buildFlow(scripting: ArchitectScripting) {
const { archFactoryFlows, archFactoryActions } = scripting.factories;

const flow = await archFactoryFlows.createFlowWorkflowAsync(
Expand Down Expand Up @@ -33,6 +33,6 @@ export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
// End workflow
archFactoryActions.addActionEndWorkflow(sequence);

await flow.checkInAsync();
return await flow.checkInAsync();
}
```
6 changes: 3 additions & 3 deletions skills/write-flow/references/sdk-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Every flow file must export this function:
```typescript
import type { ArchitectScripting } from "purecloud-flow-scripting-api-sdk-javascript";

export async function buildFlow(scripting: ArchitectScripting): Promise<void> {
export async function buildFlow(scripting: ArchitectScripting) {
const { archFactoryFlows, archFactoryActions } = scripting.factories;

const flow = await archFactoryFlows.createFlowInboundCallAsync(
Expand All @@ -30,14 +30,14 @@ export async function buildFlow(scripting: ArchitectScripting): Promise<void> {

// Build the flow logic...

await flow.checkInAsync();
return await flow.checkInAsync();
}
```

- The SDK instance is passed as a parameter — never `require()` it
- Only use `import type` from the SDK package
- The deploy runner handles authentication and session management
- Call `flow.checkInAsync()` to save the flow to Genesys Cloud
- Return `await flow.checkInAsync()` — this saves the flow and returns the flow object, which the deploy runner uses to run `validateAsync()` and report validation warnings/errors

## Flow Creation Methods

Expand Down
19 changes: 18 additions & 1 deletion src/deploy-runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function emit(
success: boolean;
flowId?: string;
flowName?: string;
warnings?: string[];
error?: string;
},
): void;
Expand Down Expand Up @@ -337,7 +338,23 @@ async function main(): Promise<void> {
const flowName =
typeof flowResult?.name === "string" ? flowResult.name : undefined;

emit("result", { success: true, flowId, flowName });
let warnings: string[] | undefined;
if (typeof flowResult?.validateAsync === "function") {
const validation = await flowResult.validateAsync();
if (validation.hasErrorsOrWarnings) {
warnings = [];
for (const issue of validation.issues) {
const label = issue.archObject?.logStr ?? "Unknown";
for (const err of issue.errors ?? [])
warnings.push(`ERROR [${label}]: ${err}`);
for (const warn of issue.warnings ?? [])
warnings.push(`WARN [${label}]: ${warn}`);
}
for (const w of warnings) emit("log", "warn", w);
}
}

emit("result", { success: true, flowId, flowName, warnings });
} catch (err) {
const message = err instanceof Error ? err.message : String(err);
emit("result", { success: false, error: message });
Expand Down
5 changes: 5 additions & 0 deletions src/mcp-server/tools/deploy-flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface DeployRunnerLine {
success?: boolean;
flowId?: string;
flowName?: string;
warnings?: string[];
error?: string;
}

Expand Down Expand Up @@ -164,6 +165,10 @@ export const deployFlow: ToolFactory<DeployFlowConfig> = (toolConfig) => ({
parts.push(`Flow ID: ${resultLine.flowId}`);
if (resultLine.flowName)
parts.push(`Flow Name: ${resultLine.flowName}`);
if (resultLine.warnings?.length)
parts.push(
`\nValidation warnings:\n${resultLine.warnings.join("\n")}`,
);

settle({
content: [
Expand Down