-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
65 lines (53 loc) · 1.94 KB
/
Copy pathindex.php
File metadata and controls
65 lines (53 loc) · 1.94 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
61
62
63
64
65
<?php
/*
//comecar : variável de iniciar o bot
//avaliar : clicou em avaliar no menu
//pular : clicou em pular configurações
// verificar a senha
if ($_REQUEST['hub_verify_token'] === $hubVerifyToken) {
echo $_REQUEST['hub_challenge'];
exit;
}
// conectar com facebook
$input = json_decode(file_get_contents('php://input'), true);
$senderId = $input['entry'][0]['messaging'][0]['sender']['id'];
$messageText = $input['entry'][0]['messaging'][0]['message']['text'];
$clicou = $input['entry'][0]['messaging'][0]['postback']['payload'];
$authorization_code = $input['entry'][0]['messaging'][0]['account_linking']['authorization_code'];
$status_linked = $input['entry'][0]['messaging'][0]['account_linking']['status'];
if(!empty($clicou))
{
eventos($clicou, $senderId, $accessToken);
}
if(!empty($authorization_code) && !empty($status_linked))
{
sendTextMessage("Login Efetuado com Sucesso", $senderId, $accessToken);
sendTextMessage($authorization_code, $senderId, $accessToken);
//sendTextMessage($status_linked, $senderId, $accessToken);
}
*/
include "config.php";
include "sends.php";
include "functions.php";
include "payloads.php";
$hubVerifyToken = "chatbotCV";
$accessToken = "EAAVKUr1VS74BAMPr6C4MPe0T7OZAn2tNfDzYiaLf2ynOTKZAVNwbvA4ZCPjdNj0FzJAInydhzcG103KbOSMiKacZBYI8RqSsTwFe9AMsiXEFHZCCnxfZBgWCbYqB5jNkWx4eFbJmiP4ZAMj35c7JTx600aYEJgx8LIcVRINQFhiC1HSa9gHZCTeedoRCv0rwqwgZD";
// verificar a senha
if ($_REQUEST['hub_verify_token'] === $hubVerifyToken) {
echo $_REQUEST['hub_challenge'];
exit;
}
// Ler mensagem do facebook
$input = json_decode(file_get_contents('php://input'), true);
$senderId = $input['entry'][0]['messaging'][0]['sender']['id'];
$messageText = $input['entry'][0]['messaging'][0]['message']['text'];
$clicou = $input['entry'][0]['messaging'][0]['postback']['payload'];
if(!empty($messageText))
{
sendTextMessage($messageText, $senderId, $accessToken);
}
if(!empty($clicou))
{
eventos($clicou, $senderId, $accessToken);
}
?>