You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Dialogflow-CX/webhook.py
+17-24Lines changed: 17 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -25,36 +25,29 @@ def handle_webhook(request):
25
25
tag=req["fulfillmentInfo"]["tag"]
26
26
27
27
iftag=="Default Welcome Intent":
28
-
# You can also use the google.cloud.dialogflowcx_v3.types.WebhookRequest protos instead of manually writing the json object
29
-
# Please see https://googleapis.dev/python/dialogflow/latest/dialogflow_v2/types.html?highlight=webhookresponse#google.cloud.dialogflow_v2.types.WebhookResponse for an overview
30
-
res= {
31
-
"fulfillment_response": {
32
-
"messages": [{"text": {"text": ["Hi from a GCF Webhook"]}}]
33
-
}
34
-
}
28
+
text="Hello from a GCF Webhook"
35
29
eliftag=="get-name":
36
-
res= {
37
-
"fulfillment_response": {
38
-
"messages": [{"text": {"text": ["My name is Phlowhook"]}}]
39
-
}
40
-
}
30
+
text="My name is Flowhook"
41
31
else:
42
-
res= {
43
-
"fulfillment_response": {
44
-
"messages": [
45
-
{
46
-
"text": {
47
-
"text": [
48
-
f"There are no fulfillment responses defined for {tag} tag"
49
-
]
50
-
}
32
+
text=f"There are no fulfillment responses defined for {tag} tag"
33
+
34
+
# You can also use the google.cloud.dialogflowcx_v3.types.WebhookRequest protos instead of manually writing the json object
35
+
# Please see https://googleapis.dev/python/dialogflow/latest/dialogflow_v2/types.html?highlight=webhookresponse#google.cloud.dialogflow_v2.types.WebhookResponse for an overview
0 commit comments