0

I am trying to update a Lex bot using the python SDK put_bot function. I need to pass a checksum value of the function as specified here. How do I get this value? So far I have tried using below functions and the checksum values returned from these

  1. The get_bot with the prod alias
  2. The get_bot_alias function
  3. The get_bot_aliases function

Is the checksum value

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
AndyLon
  • 11
  • 3

2 Answers2

0

Lex Model Building Service:

checksum (string) -- Identifies a specific revision of the $LATEST version.

When you create a new bot, leave the checksum field blank. If you specify a checksum you get a BadRequestException exception.

When you want to update a bot, set the checksum field to the checksum of the most recent revision of the $LATEST version. If you don't specify the checksum field, or if the checksum does not match the $LATEST version, you get a PreconditionFailedException exception.

You should first retrieve the checksum of your bot if you want to update it.

You should be able to use the same checksum that is returned from get_bot_aliases().

This is the example response from get_bot_aliases() function.

{
    'BotAliases': [
        {
            'name': 'string',
            'description': 'string',
            'botVersion': 'string',
            'botName': 'string',
            'lastUpdatedDate': datetime(2015, 1, 1),
            'createdDate': datetime(2015, 1, 1),
            'checksum': 'string',                             --checksum here
            'conversationLogs': {
                'logSettings': [
                    {
                        'logType': 'AUDIO'|'TEXT',
                        'destination': 'CLOUDWATCH_LOGS'|'S3',
                        'kmsKeyArn': 'string',
                        'resourceArn': 'string',
                        'resourcePrefix': 'string'
                    },
                ],
                'iamRoleArn': 'string'
            }
        },
    ],
    'nextToken': 'string'
}
Jay A. Little
  • 3,239
  • 2
  • 11
  • 32
  • @AndyLon I noticed you may have tried to do this already. You should include the relevant code and/or errors associated with what you have tried, since this method should work. – Jay A. Little Jun 22 '20 at 15:31
0

If you are trying to update intent, first do get_intent and save the checksum and use it in put_intent, If you are using the put_bot api, then first get_bot and save the checksum in that , use it in put_bot api

Hemanth Sharma
  • 309
  • 3
  • 6