Skip to content

Instantly share code, notes, and snippets.

Avatar

dipesh pandey mepesh

View GitHub Profile
View dialogflow_text_return_webhooks
app.route("/elements/text_only", methods=['POST'])
def text_only():
response = dynamic_method()
reply = { "fulfillmentText": response }
return jsonify(reply)
View dialogflow_quick_replies_custom
def quick_replies():
text = "dynamic text"
response = [
{
"quickReplies": {
"title": text,
"quickReplies": [
"Quick Reply 1",
"Quick Reply 2",
"Quick Reply 3"
View dialogflow_multiple_card_layout
app.route("/elements/multiple_card", methods=['POST'])
def multiple_card():
data = news['data']
data1 = data[0]
data2 = data[1]
data3 = data[2]
response = [{
"card":{
"title":data1['title'],
View dialogflow_card_layout
app.route("/elements/card", methods=['POST'])
def card_return():
response = [
{
"card":{
"title": "Card Title",
"subtitle":"Subtitle Here",
"imageUri": "https://stock.rtl.lu/rtl/800/rtl2008.lu/nt/p/2020/04/09/16/fdfbf19dc86cb2ef05908e9e83885f97.png",
"buttons":[
{
@mepesh
mepesh / connect-google-sheet-with-python-code.py
Created Mar 30, 2020
connect-google-sheet-with-python-code
View connect-google-sheet-with-python-code.py
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
credentials = ServiceAccountCredentials.from_json_keyfile_name('mechnepal-test-54c4387178d9.json', scope)
client = gspread.authorize(credentials)
worksheet = client.open('corona-help-resource-management').sheet1
#Add new row to the worksheet.
worksheet.append_row(["1", "food", "dipesh", "9847301001", "Address"])
@mepesh
mepesh / dialogueflow-custom-payloads-card-templete.py
Last active Mar 30, 2020
dialogueflow-custom-payloads-card-templete
View dialogueflow-custom-payloads-card-templete.py
elif(intent == "news-nepal-int"):
url = "https://nepalcorona.info/api/v1/news"
response = requests.get(url)
news = json.loads(response.text)
data = news['data']
data1 = data[0]
data2 = data[1]
data3 = data[2]
# response1 = "Here are the latest news \n"+data1['url']+"\n"+data2['url']+"\n"+data3['url']
response2 = [{
View python_lists.txt
apple = ['apple','ball','cat','ball',25,26.5]
print(apple)
#index is used only for all data types
apple.index('ball')