in CBHelper-evaluateCallBack/lambda_function.py [0:0]
def update_contact(phone, contactId, table):
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table(table)
try:
response = table.update_item(
Key={
'phone': phone
},
UpdateExpression='SET #item = :newState',
ExpressionAttributeNames={
'#item': 'contactId'
},
ExpressionAttributeValues={
':newState': contactId
},
ReturnValues="UPDATED_NEW")
print (response)
except Exception as e:
print (e)
else:
return response