All Projects → pragnakalp → dialogflow-webhook-response-libary-in-python

pragnakalp / dialogflow-webhook-response-libary-in-python

Licence: MIT license
This library simplifies the JSON response building in Python for Dialogflow.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to dialogflow-webhook-response-libary-in-python

small-talk-rasa-stack
Collection of casual conversations that can be used with the Rasa Stack
Stars: ✭ 87 (+55.36%)
Mutual labels:  dialogflow
tcWebHooks
WebHooks plugin for Teamcity. Supports many build states and payload formats.
Stars: ✭ 128 (+128.57%)
Mutual labels:  webhook
snmp notifier
A webhook to relay Prometheus alerts as SNMP traps, because sometimes, you have to deal with legacy
Stars: ✭ 33 (-41.07%)
Mutual labels:  webhook
k8s-mutate-webhook
A playground to build a very crude k8s mutating webhook in Go
Stars: ✭ 55 (-1.79%)
Mutual labels:  webhook
kube-watch
Simple tool to get webhooks on Kubernetes cluster events
Stars: ✭ 21 (-62.5%)
Mutual labels:  webhook
deployserver
Deploy your project automatically when git branch was updated.
Stars: ✭ 24 (-57.14%)
Mutual labels:  webhook
github-release-notifier
Automatize tasks when a specific package got a new release - Github Release Notifier
Stars: ✭ 21 (-62.5%)
Mutual labels:  webhook
telegram-bot-tutorial
Telegram bot tutorial using python and flask
Stars: ✭ 44 (-21.43%)
Mutual labels:  webhook
deploy
Used to deploy project, includes webhooks.
Stars: ✭ 15 (-73.21%)
Mutual labels:  webhook
pyTwitchAPI
A Python 3.7 implementation of the Twitch API, EventSub and PubSub
Stars: ✭ 132 (+135.71%)
Mutual labels:  webhook
disgo
A modular Golang Discord API Wrapper
Stars: ✭ 113 (+101.79%)
Mutual labels:  webhook
Temps
λ A selfhostable serverless function runtime. Inspired by zeit now.
Stars: ✭ 15 (-73.21%)
Mutual labels:  webhook
micro-dockerhub-hook
Automatic docker deployment with webhooks
Stars: ✭ 32 (-42.86%)
Mutual labels:  webhook
dialogflow-go-webhook
Simple package to create DialogFlow v2 webhooks using Go
Stars: ✭ 23 (-58.93%)
Mutual labels:  dialogflow
Phoenix
🔥 Discord autoreply bot using DialogFlow
Stars: ✭ 63 (+12.5%)
Mutual labels:  dialogflow
rebasebot
A GitHub bot that rebases your branches
Stars: ✭ 43 (-23.21%)
Mutual labels:  webhook
Aftermath
A simple anti token-grabber, written in Python.
Stars: ✭ 40 (-28.57%)
Mutual labels:  webhook
plugin-gogs-webhook
[NOT MAINTAINED] Plugin to handle Gogs Webhooks
Stars: ✭ 29 (-48.21%)
Mutual labels:  webhook
mulukhiya-toot-proxy
各種ActivityPub対応インスタンスへの投稿に対して、内容の更新等を行うプロキシ。通称「モロヘイヤ」。
Stars: ✭ 24 (-57.14%)
Mutual labels:  webhook
PhpBotFramework
A framework for Telegram Bot API written in PHP.
Stars: ✭ 56 (+0%)
Mutual labels:  webhook

Dialogflow Fulfillment Webhook Response Library in Python

This library simplifies the JSON response building in Python for Dialogflow fulfillment.

Using this libray you can build the JSON objects with few line.

Supported Platforms - Actions on Google, Facebook Messenger and Telegram

Update - We have published a tutorial to create a basic webhook in Python + Django Dialogflow Tutorial: Create Fulfillment Webhook Using Python + Django which will be useful to setup this library in Python + Django. We have also published a new repo to showcase examples of creating different responses using this library.

How to use

To get started just import all the functions from the library using the following statement

from df_response_lib import *

Supported Responses

Actions on Google

  • Simple Response
  • Basic Card
  • Suggestion Chips
  • Link out suggestion
  • List Response
  • More will be added soon

Facebook and Telegram

  • Text Response
  • Card Response
  • Image Response
  • Quick replies

DF-messenger Responses

  • Simple response
  • Suggestion chips
  • Simple title card
  • Informative card
  • Image
  • Small button
  • Card with multiple options
  • Accordion small card

Dialogflow Fulfillment Responses

  • Fulfillment Text
  • Fullfillment Messages
  • Followup Event Input
  • Output Contexts

Actions on Google

Simple Response

simple_response(responses)

responses - list of simple responses

["Text to be displayed", "Text to be spoken", ssml=True|False]

ex.

aog_sr = aog.simple_response([
	["Hello", "Hi", False],
	["Hey!!", "<speak>Hey</speak>", True]
])

Basic Card

basic_card(title, subtitle="", formattedText="", image=None, buttons=None)

title is the title of card - string
subtitle is the subtitle of the card - string
formattedText is the description of the card - limited markdown
image display image in the card - list

image = [imageUri, accessibilityText]

buttons add buttons to thr card

buttons = [
	[button_title, url]
]

ex.

image = ['https://imagepath.com/path.png', 'sample image']

buttons = [
	['button_1', 'https://www.google.com/'],
	['button 2', 'https://www.facebook.com/']
]

aog_card = aog.basic_card("card title", "card subtitle", "card *description*", image, buttons)

Suggestion Chips

suggestion_chips(suggestions)

suggestions - list of suggestions upto 8 items (one item length upto 25)

suggestions = ['chip1', 'chip2', 'chip3', 'chip4']

ex.

aog_suggestions = aog.suggestion_chips(suggestions)

Link out Suggestion

link_out_suggestion(title, url)

title - Text to be shown in suggestion
url - Link URL

ex.

title = "Link to google"
url = "https://www.google.com/"
aog_los = aog.link_out_suggestion(title, url)

List Select Response

list_select(list_title, list_elements)

list_title - title of the list
list_elements - list of items of the list select

[
	['item_title', 'item_description', item_info=['item_key', item_synonyms=['synonym1', 'synonym2'], ['imageURL', 'imageDescription']],
	['item2_title', 'item2_description', item_info=['item_key', item_synonyms=['synonym1', 'synonym2'], ['imageURL', 'imageDescription']]
]

ex.

list_elements = [
	['item_title', 'item_description', ['item_key', ['synonym1', 'synonym2'], ['imageURL', 'imageDescription']],
	['item2_title', 'item2_description', ['item2_key',['synonym1', 'synonym2'], ['imageURL', 'imageDescription']]
]

aog_list = aog.list_select("this is a list', list_elements)

Facebook and Telegram

Text response

text_response(texts)

texts - list of text

['text1', 'text2', 'text3']

ex.

texts = ['text1', 'text2', 'text3']
text_res = fb.text_response(texts)

Quick Replies

quick_replies(title, quick_replies_list)

quick_replies_list - list of quick replies text

['reply1', 'reply2', 'reply3']

ex.

title = "Choose something"
replies= ['reply1', 'reply2', 'reply3']
fb_quick_replies = fb.quick_replies(title, replies)

Image Response

image_response(url)

url - image URL

ex.

url = "https://www.xyz.com/image.png"
fb_image = fb.image_response(url)

Card Response

card_response(title, buttons)

card title - title of the card
buttons - list of buttons

[
	['button1', 'hello'],
	['button2', 'hello again']
]

ex.

title = "this is a card"
buttons = [
	['button1', 'hello'],
	['button2', 'hello again']
]

fb_card = fb.card_response(title, buttons)

Dialogflow messenger

Simple Response

wb = web_response()

texts - list of text

['simple response']

ex.

texts = ['simple response']
text_res = wb.simple_response(texts)

Suggestion Chips

suggestion_chips(suggestion_chips_list)

suggestion_chips_list - list of suggestion chips text

['reply1', 'reply2', 'reply3']

ex.

replies= ['reply1', 'reply2', 'reply3']
wb_suggestion_chips = wb.suggestion_chips(replies)

Image Response

image_response(url, accessibility_text)

url - image URL

ex.

accessibility_text = "This is an accessibility text"
url = "https://www.xyz.com/image.png"
wb_image = wb.image_response(url, accessibility_text)

Card Response

card_response(title, sub_title, raw_url, action_link)

title - title of the card
sub_title - sub title of the card
raw_url - URL of image for card
action_link - redirect URL for card

ex.

title = "title"
sub_title = "subtitle"
raw_url = "www.xyz.com"
action_link = "www.abc.com"

wb_card = wb.simple_title_card(title, sub_title, raw_url, action_link)

Informative card

informative_card(title, text_list)

title - title of the card
text_list - list of text to be displayed in the card

ex.

title = "title"
text_list = ["Sample Text1","Sample Text2","Sample Text3"]

informative_card = wb.informative_card(title, text_list)

Small button

small_button(text, url)

text - text for button
url - URL for image to be displayed on the button

ex.

text = "Sample text"
url = "www.xyz.com"

wb_card = wb.small_button(text, url)

Card with multiple options

card_with_multiple_options(data)

data - list of dictionary with title and subtitle for the card

ex.

data = [
    {
        "title": "title1",
        "subtitle": "subtitle1"
    },
    {
        "title": "title2",
        "subtitle": "subtitle2"
    }
]

wb_card = wb.card_with_multiple_options(data)

Accordion card response

accordion_small_card(title, sub_title, raw_url, text)

title - title of the card
sub_title - sub title of the card
raw_url - URL of image for the card
text - text for the card

ex.

title = "title"
sub_title = "subtitle"
raw_url = "www.xyz.com"
text = "Sample Text"

wb_card = wb.accordion_small_card(title, sub_title, raw_url, text)

Dialogflow Fulfillment Responses

Fulfillment Text

fulfillment_text(fulfillmentText)

fulfillmentText - defult response text ex.

text = "This is a fulfillment text"
df_fft = main_response.fulfillment_text(text)

Fulfillment Messages

fulfillment_messages(self, response_objects)

response_objects - list of supported response (any of the above)

[aog_sr, aog_list, aog_suggestions, fb_text, fb_card]

ex.

res_objects = [aog_sr, aog_list, aog_suggestions]
ff_msgs = main_response.fulfillment_messages(res_objects)

Output Contexts

output_contexts(session, contexts)

session - session Id of the request
contexts - list of contexts

[
	['context_name', 'lifespanCount', 
		{
			'paramter_name': 'value'
		}	
	]
]

Followup Event Input

followup_event_input(name, parameters)

name - event name
paramters - event parameters

{
	'parameter_name': 'values',
	'another_parameter_name': 'values',
}

Main Response

main_response(fulfillment_text, fulfillment_messages=None, output_contexts=None, followup_event_input=None):

fulfillment_text - Fulfillment text object
fulfillment_messages - Fulfillment messages object
output_contextstext - Output contexts object
followup_event_input - Followup event input object

Return this as your main fulfillment response.


We are working to add more responses in the future. Please give your feedback and do contribute if you like.

Developed by Pragnakalp Techlabs - Artificial Intelligence, Machine Learning, Deep Learning, Chatbots Development

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].