Genius Integration - mrcunninghamz/hi-command GitHub Wiki

Objective

This is an integration to Genius' API. The plan is to have the command "/hi quote [artist]" return a line from the artist with the song title and "/hi quote" will return a random artist and song.

Expected output

"Never get high off your own supply" - Notorious B.I.G., "Ten Crack Commandments"

Development Notes

This is how to call another lambda from inside of a lambda, assuming the lambda you are calling you own and is in the same region:

    using (var awsClient = new AmazonLambdaClient())
    {
        var request = new InvokeRequest()
        {
            //this is the name you gave the lambda during publish
            FunctionName = "HiCommand_Quote", 
                
            //this is a json string representation of the input 
            //param to send to your lambda
            Payload = JsonConvert.SerializeObject(slackMessage),

            //this says this is an async invocation type
            InvocationType = InvocationType.Event 
        };
        await awsClient.InvokeAsync(request);
    }

Also in your project.json you need to a reference to:

"AWSSDK.Lambda": "3.3.2.6"

Otherwise you end up getting an error. CloudWatch will show you the error in the logs, this is actually quite helpful.