Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Tell a random joke

To create a function that tells a random joke that you can leverage in your Autopilot experience, you can use a function to call the icanhazdadjoke api which returns a random joke.

const axios = require('axios');

exports.handler = function(context, event, callback) {
    axios.get('', {
        headers: {
            Accept: 'text/plain'
        let result = {
            "actions": [
                    "listen": true
        callback(null, result);

Don't forget to add the axios dependency here.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.