npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dailogflow_json_function

v1.0.6

Published

This is just for calling responses of dialog flow through JSON and node All the this written below for how to use it:-

Downloads

9

Readme

This is just for calling responses of dialog flow through JSON and node All the this written below for how to use it:-

context_url = "projects/practice-prove/agent/sessions/ticketak/contexts/"; exports.simple_res = function (user_strg, text_voice, text_to_speech, sgsn_1, sgsn_2, sgsn_3, sgsn_4, sgsn_5, context_value) { if (!context_value){ if(sgsn_2 == '' && sgsn_3 == '' && sgsn_4 == '' && sgsn_5 == ''){ sugges = [ { "title": sgsn_1 } ] } else if(sgsn_3 =='' && sgsn_4=='' && sgsn_5==''){ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 } ] } else if(sgsn_4=='' && sgsn_5==''){ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 }, { "title": sgsn_3 } ] } else if(sgsn_5==''){ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 }, { "title": sgsn_3 }, { "title": sgsn_4 } ] } else{ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 }, { "title": sgsn_3 }, { "title": sgsn_4 }, { "title": sgsn_5 } ] }

let response = {
"payload": {
    "google": {
        "userStorage": user_strg,
        "expectUserResponse": true,
        "richResponse": {
            "items": [
                {  
                    "simpleResponse": {
                      "ssml": text_voice,
                      "displayText": text_to_speech    
                    }
                }                           
            ],
             "suggestions": sugges
        }
    }
}
}
return response;

} else{ if(sgsn_2 == '' && sgsn_3 == '' && sgsn_4 == '' && sgsn_5 == ''){ sugges = [ { "title": sgsn_1 } ] } else if(sgsn_3 =='' && sgsn_4=='' && sgsn_5==''){ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 } ] } else if(sgsn_4=='' && sgsn_5==''){ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 }, { "title": sgsn_3 } ] } else if(sgsn_5==''){ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 }, { "title": sgsn_3 }, { "title": sgsn_4 } ] } // if context exist else{ sugges = [ { "title": sgsn_1 }, { "title": sgsn_2 }, { "title": sgsn_3 }, { "title": sgsn_4 }, { "title": sgsn_5 } ] } let response = { "payload": { "google": { "userStorage": user_strg, "expectUserResponse": true, "richResponse": { "items": [ {
"simpleResponse": { "ssml": text_voice, "displayText": text_to_speech
} }
], "suggestions": sugges } } }, "outputContexts": [ { "name": context_url+context_value, "lifespanCount": 1 } ] } return response; } }

exports.simple_res_without_sugges = function(user_strg, check_exit, text_voice, text_to_speech,context_value){ let response = { "payload": { "google": { "userStorage": user_strg, "expectUserResponse": check_exit, "richResponse": { "items": [ {
"simpleResponse": { "ssml": text_voice, "displayText": text_to_speech
} }
], } } }, "outputContexts": [ { "name": context_url+context_value, "lifespanCount": 1 } ] } return response; }

exports.basic_card = function(user_strg, text_voice, text_to_speech, formatted_text, title_text, image_ulr, sgsn_1, sgsn_2, sgsn_3){ let response ={ "payload": { "google": { "userStorage": user_strg, "expectUserResponse": true, "richResponse": { "items": [ { "simpleResponse": { "ssml": text_voice, "displayText": text_to_speech
} }, { "basicCard": { "formattedText": formatted_text, "title": title_text, "image": { "url": image_ulr, "accessibilityText": "Google Logo" }, // "buttons": [ // { // "title": "Click Here", // "openUrlAction": { // "url": "https://www.reliancegeneral.co.in/Insurance/Self-Help/Intimate-Claim-Health.aspx" // } // } // ], "imageDisplayOptions": "WHITE" } } ], "suggestions": [

        {
            "title": sgsn_1
        },
        {
            "title": sgsn_2
        },
        {
            "title": sgsn_3
        }
    ]
    }
  }
}

} return response;

}

exports.carousel_card = function(user_strg, text_voice, text_to_speech, item, context_value){ let response = { "payload": { "google": { "userStorage": user_strg, "expectUserResponse": true, "richResponse": { "items": [ { "simpleResponse": { "ssml": text_voice, "displayText": text_to_speech
} } ] }, "systemIntent": { "intent": "actions.intent.OPTION", "data": { "@type": "type.googleapis.com/google.actions.v2.OptionValueSpec", "carouselSelect": { "items": item } } } } }, "outputContexts": [ { "name": context_url+context_value, "lifespanCount": 1 } ] } return response; }

exports.permission = function(user_strg,text_to_speech,name,email,location,context_value){ if(name =='' && email ==''){ permission_arr = [ location ] } else if(location == ''){ permission_arr = [ name, email ] } else{ permission_arr = [ name, email, location ] }

let response = { "payload": { "google": { "userStorage": user_strg, "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.PERMISSION", "data": { "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec", "optContext": text_to_speech, "permissions": permission_arr } } } }, "outputContexts": [ { "name": context_url+context_value, "lifespanCount": 1 } ] } return response; }

exports.permission_for_notification = function(user_strg, text_to_speech, intent_name, context_value){ let response = { "payload": { "google": { "userStorage": user_strg, "expectUserResponse": true, "systemIntent": { "intent": "actions.intent.PERMISSION", "data": { "@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec", "optContext": text_to_speech, "permissions": [ "UPDATE" ], "updatePermissionValueSpec": { "intent": intent_name } } } } }, "outputContexts": [ { "name": context_url+context_value, "lifespanCount": 1 } ] } resolve(response); }

// res.send(all_templetes.permission( // '1st argument is for user storage', // '2nd argument is for text to speech', // '3rd argument is for intent name', // '4th_argument_is_for_context' // ))

// here is how to defined dynamic carousel's item // let item = []; // if (result.length > 0) { // Object.keys(result).forEach(function(key) { // var row = result[key]; // name = row.shop_name; // image = row.image; // id = row.id; // shop_des = row.shop_desc; // // carousel bna re h // let itemObj = {}; // let optionInfoObj = {}; // let imageObj = {}; // optionInfoObj.key = name; // itemObj.optionInfo = optionInfoObj; // itemObj.title = name; // imageObj.url = image; // itemObj.description = shop_des; // imageObj.accessibilityText = name; // itemObj.image = imageObj; // item.push(itemObj); // }) // }

// here is how to defined static carousel's item // let item = [ // { // "optionInfo": { // "key": "1st key" // }, // "description": "1st description text", // "image": { // "url": "1st image url", // "accessibilityText": "1st accesbility text" // }, // "title": "1st title text" // }, // { // "optionInfo": { // "key": "2nd key" // }, // "description": "2nd description text", // "image": { // "url": "2nd image url", // "accessibilityText": "2nd accesbility text" // }, // "title": "2nd title text" // }, // // if you want to show more cards in this caousel then you can easily show. // ]

// this is how to call functions in your if else conditions //res.send(all_templetes.{here your response type}({here your arguments}))

// permission pattern // NAME, EMAIL, DEVICE_PRECISE_LOCATION