-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirst.js
More file actions
60 lines (47 loc) · 1.43 KB
/
Copy pathfirst.js
File metadata and controls
60 lines (47 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const express = require("express")
const app = new express();
const d = require("dialogflow-fulfillment");
app.post("/",express.json(),function(req,res){
var agent = new d.WebhookClient({request:req,response:res});
var intent = new Map();
function demo(agent){
var p = {
"richContent":
[
[
{
"type": "info",
"title": "Acer",
"subtitle": "Laptop",
"image": {
"src": {
"rawUrl": "https://example.com/images/logo.png"
}
},
"actionLink": "http://localhost/amazon/order.php?c=Electronics&&pid=3"
}
],
[
{
"type": "info",
"title": "Acer",
"subtitle": "Laptop",
"image": {
"src": {
"rawUrl": "https://example.com/images/logo.png"
}
},
"actionLink": "http://localhost/amazon/order.php?c=Electronics&&pid=1"
}
]
]
};
agent.add(new d.Payload(agent.UNSPECIFIED,p,{sendAsMessage:true,rawPayload:true}));
}
intent.set('demo',demo);
agent.handleRequest(intent);
});
app.get("/",function(req,res){
res.send("hui");
});
app.listen(3000);