def add_metadata(phone_number, key, value): dynamo_client.update_item( TableName=TABLE_NAME, Key={ 'phone_number': {"S": sanitize_phone_number(phone_number)} }, AttributeUpdates={ key: { "Action": "PUT", "Value": {"S": str(value)} } } )
def add_metadata(team_id, key, value): dynamo_client.update_item( TableName=TABLE_NAME, Key={ 'team_id': {"S": team_id} }, AttributeUpdates={ key: { "Action": "PUT", "Value": {"S": str(value)} } } )
def modify_consumptions(phone_number, consumptions=1): dynamo_client.update_item( TableName=TABLE_NAME, Key={ 'phone_number': {"S": sanitize_phone_number(phone_number)} }, AttributeUpdates={ "consumptions": { "Action": "ADD", "Value": {"N": str(consumptions * -1)} }, "message_count": { "Action": "ADD", "Value": {"N": str(consumptions * 1)} } } )