| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This code sample will update your catalogs and skill with the use of ASK NodeJS SDK. Developers will need to provide their own client id, client secret, and refresh token.
npm install -g aws-cdk cdk init app --language=typescript
npm install aws-sdk
import * as cdk from 'aws-cdk-lib'; import * as lambda from 'aws-cdk-lib/aws-lambda'; import * as events from 'aws-cdk-lib/aws-events'; import * as targets from 'aws-cdk-lib/aws-events-targets';
export class YourStackNameStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
// Define the Lambda function
const lambdaFunction = new lambda.Function(this, 'YourLambdaFunction', {
runtime: lambda.Runtime.NODEJS_14_X,
handler: 'index.handler',
code: lambda.Code.fromAsset("PATH_TO_ASK_AUTOMATIC_CATALOG_UPDATE_FUNCTION"),
});
// Create an EventBridge rule to trigger the Lambda function every hour
const rule = new events.Rule(this, 'YourRule', {
schedule: events.Schedule.cron({ hour: '0' }),
});
// Add the Lambda function as the target of the EventBridge rule
rule.addTarget(new targets.LambdaFunction(lambdaFunction));
}
}
Note: This can be done without AWS CDK. Simply zip up node package and configure AWS lambda/Eventbrige via AWS console
Modify the runInteractionModelUpdateWorkflow function in index.js to the following to submit skill for instant publish.
Note: Skill will not instant publish if there are changes other than catalog values.
async function runInteractionModelUpdateWorkflow() {
try {
await createDirectories();
await createInteractionModelCatalogVersion();
await getSkillPackageAndUpdateCatalogVersion();
await submitSkillForCertification();
} catch (error) {
console.error('Error when running update workflow', error);
throw new Error('Workflow failed', {cause: error});
}
}
| Back | FazBrowse Home | New Git URL |