slackbot/handler.js
// Lookup method in dynamo for accounts
Lookup method in dynamo for accounts
Lookup method in dynamo for accounts
function obtainAccount(idNum, callback) {
  var params = {
    TableName: "Accounts",
    KeyConditionExpression: "#iden = :id",
    ExpressionAttributeNames: {
      "#iden": "id"
    },
    ExpressionAttributeValues: {
      ":id": idNum
    }
  };
  console.log('querying for account number with following query: ' + JSON.stringify(params));
  docClient.query(params, function(err, data) {
    if (err) {
      console.log("Unable to query. Error:", JSON.stringify(err, null, 2));
    } else {
      console.log('invoking callback with param: ' + JSON.stringify(data.Items[0]));
      callback(data.Items[0]);
    }
  });
}
function obtainAccount ( idNum , callback ) { var params = { TableName : "Accounts" , KeyConditionExpression : "#iden = :id" , ExpressionAttributeNames : { "#iden" : "id" } , ExpressionAttributeValues : { ":id" : idNum } } ; console . log ( 'querying for account number with following query: ' + JSON . stringify ( params ) ) ; docClient . query ( params , function ( err , data ) { if ( err ) { console . log ( "Unable to query. Error:" , JSON . stringify ( err , null , 2 ) ) ; } else { console . log ( 'invoking callback with param: ' + JSON . stringify ( data . Items [ 0 ] ) ) ; callback ( data . Items [ 0 ] ) ; } } ) ; }
Lookup method in dynamo for accounts
Lookup method in dynamo for accounts