├── .github
├── FUNDING.yml
└── SECURITY.md
├── .gitignore
├── README.md
├── bootstrap
└── bootstrap.php
├── classes
├── erlhcoreclassfbvalidator.php
├── erlhcoreclassmodelfblead.php
├── erlhcoreclassmodelfbnotificationschedule.php
├── erlhcoreclassmodelfbnotificationschedulecampaign.php
├── erlhcoreclassmodelfbnotificationscheduleitem.php
├── erlhcoreclassmodelfbpage.php
├── erlhcoreclassmodelfbuser.php
├── erlhcoreclassmodelmyfbpage.php
├── filter.php
└── filter
│ ├── account.php
│ ├── bbcode.php
│ ├── campaign.php
│ ├── campaign_recipient.php
│ ├── leads.php
│ ├── mailbox.php
│ ├── mailing_recipient.php
│ ├── messages.php
│ └── notifications.php
├── design
└── fbmessengertheme
│ ├── images
│ ├── F_icon.svg
│ ├── fblogin.png
│ ├── instagram.png
│ ├── login-fb.png
│ └── social
│ │ ├── instagram-ico.png
│ │ ├── messenger-ico.png
│ │ └── whatsapp-ico.png
│ ├── js
│ ├── extension.fbwhatsapp.js
│ ├── libphonenumber-js.min.js
│ └── libphonenumber-max.js
│ └── tpl
│ ├── lhchat
│ └── chat_tabs
│ │ └── information_rows
│ │ ├── extension_information_row_multiinclude.tpl.php
│ │ └── information_order_extension_multiinclude.tpl.php
│ ├── lhfbmessenger
│ ├── chat_profile.tpl.php
│ ├── edit.tpl.php
│ ├── editnotification.tpl.php
│ ├── fbcallback.tpl.php
│ ├── index.tpl.php
│ ├── leads.tpl.php
│ ├── list.tpl.php
│ ├── myfbpages.tpl.php
│ ├── new.tpl.php
│ ├── newnotification.tpl.php
│ ├── notifications.tpl.php
│ ├── options.tpl.php
│ ├── pagesubscribe.tpl.php
│ ├── parts
│ │ ├── form.tpl.php
│ │ ├── form_channel.tpl.php
│ │ └── form_notification.tpl.php
│ └── whatsappsubscribe.tpl.php
│ ├── lhfbwhatsapp
│ ├── account.tpl.php
│ ├── editaccount.tpl.php
│ ├── forms
│ │ └── form_account.tpl.php
│ ├── limitgenerator.tpl.php
│ ├── massmessage.tpl.php
│ ├── messages.tpl.php
│ ├── newaccount.tpl.php
│ ├── parts
│ │ ├── form_filter.tpl.php
│ │ └── form_filter_ccount.tpl.php
│ ├── quickstats.tpl.php
│ ├── rawjson.tpl.php
│ ├── rendersend.tpl.php
│ ├── rendertemplates.tpl.php
│ ├── send.tpl.php
│ └── templates.tpl.php
│ ├── lhfbwhatsappmessaging
│ ├── campaign.tpl.php
│ ├── campaignrecipient.tpl.php
│ ├── detailssend.tpl.php
│ ├── editcampaign.tpl.php
│ ├── editmailinglist.tpl.php
│ ├── editmailingrecipient.tpl.php
│ ├── import.tpl.php
│ ├── importcampaign.tpl.php
│ ├── importfrommailinglist.tpl.php
│ ├── mailinglist.tpl.php
│ ├── mailingrecipient.tpl.php
│ ├── newcampaign.tpl.php
│ ├── newcampaignrecipient.tpl.php
│ ├── newmailinglist.tpl.php
│ ├── newmailingrecipient.tpl.php
│ └── parts
│ │ ├── form_campaign.tpl.php
│ │ ├── form_campaign_recipient.tpl.php
│ │ ├── form_mailing_list.tpl.php
│ │ ├── form_mailing_recipient.tpl.php
│ │ ├── search_panel_campaign_recipient.tpl.php
│ │ ├── search_panel_mailing_recipient.tpl.php
│ │ └── search_panel_mailinglist.tpl.php
│ ├── lhfront
│ └── dashboard
│ │ └── panels
│ │ └── bodies
│ │ └── custom_title_multiinclude.tpl.php
│ ├── lhinstance
│ └── features_multiinclude.tpl.php
│ └── pagelayouts
│ └── parts
│ └── modules_menu
│ └── extension_module_multiinclude.tpl.php
├── doc
├── access_token.png
├── changelog.txt
├── contact.csv
├── default.ts
├── instagram
│ ├── bot-data.json
│ ├── chat.before_auto_responder_msg_saved.json
│ ├── chat.desktop_client_admin_msg.json
│ ├── chat.web_add_msg_admin.json
│ ├── chat.workflow.canned_message_before_save.json
│ ├── incoming-webhook.json
│ └── rest-api.json
├── install.sql
├── messenger
│ ├── bot-data.json
│ ├── chat.before_auto_responder_msg_saved.json
│ ├── chat.desktop_client_admin_msg.json
│ ├── chat.web_add_msg_admin.json
│ ├── chat.workflow.canned_message_before_save.json
│ ├── incoming-webhook.json
│ └── rest-api.json
├── products-app.png
├── structure.json
├── webhooks-app.png
├── webhooks.png
└── whatsapp
│ ├── bot-data.json
│ ├── bot-sample.json
│ ├── chat.before_auto_responder_msg_saved.json
│ ├── chat.desktop_client_admin_msg.json
│ ├── chat.web_add_msg_admin.json
│ ├── chat.workflow.canned_message_before_save.json
│ ├── incoming-webhook.json
│ ├── rest-api.json
│ └── whats-app-configuration.png
├── modules
├── lhcron
│ ├── collect_recipients.php
│ ├── masssending.php
│ ├── schedule_compaign.php
│ ├── send_notification.php
│ ├── update_structure.php
│ └── whatsapp_campaign.php
├── lhfbmessenger
│ ├── callback.php
│ ├── callbackgeneral.php
│ ├── callbackinstagram.php
│ ├── callbackstandalone.php
│ ├── callbackstandaloneinstagram.php
│ ├── callbackstandalonewhatsapp.php
│ ├── callbackwhatsapp.php
│ ├── delete.php
│ ├── deletelead.php
│ ├── deletenotification.php
│ ├── disablebot.php
│ ├── edit.php
│ ├── editnotification.php
│ ├── fbcallback.php
│ ├── fbcallbackapp.php
│ ├── fbcallbackinstance.php
│ ├── fbcallbackstandalone.php
│ ├── fblogininstance.php
│ ├── fbloginstandalone.php
│ ├── fblogout.php
│ ├── index.php
│ ├── leads.php
│ ├── list.php
│ ├── module.php
│ ├── myfbpages.php
│ ├── new.php
│ ├── newnotification.php
│ ├── notifications.php
│ ├── options.php
│ ├── pagesubscribe.php
│ ├── registerstandalone.php
│ ├── registersubscribe.php
│ ├── sendtestmessage.php
│ ├── thread.php
│ ├── threadmy.php
│ ├── updatedepartment.php
│ ├── updatedepartmentwhatsapp.php
│ └── whatsappsubscribe.php
├── lhfbwhatsapp
│ ├── account.php
│ ├── deleteaccount.php
│ ├── deletemessage.php
│ ├── editaccount.php
│ ├── limitgenerator.php
│ ├── massmessage.php
│ ├── messages.php
│ ├── module.php
│ ├── newaccount.php
│ ├── rawjson.php
│ ├── rendersend.php
│ ├── rendertemplates.php
│ ├── send.php
│ └── templates.php
└── lhfbwhatsappmessaging
│ ├── campaign.php
│ ├── campaignrecipient.php
│ ├── deletecampaign.php
│ ├── deletecampaignrecipient.php
│ ├── deletemailinglist.php
│ ├── deleterecipient.php
│ ├── detailssend.php
│ ├── editcampaign.php
│ ├── editmailinglist.php
│ ├── editmailingrecipient.php
│ ├── import.php
│ ├── importcampaign.php
│ ├── importfrommailinglist.php
│ ├── mailinglist.php
│ ├── mailingrecipient.php
│ ├── module.php
│ ├── newcampaign.php
│ ├── newcampaignrecipient.php
│ ├── newmailinglist.php
│ ├── newmailingrecipient.php
│ └── sendtestmessage.php
├── pos
├── erlhcoreclassmodelfblead.php
├── erlhcoreclassmodelfbmessengeruser.php
├── erlhcoreclassmodelfbnotificationschedule.php
├── erlhcoreclassmodelfbnotificationschedulecampaign.php
├── erlhcoreclassmodelfbnotificationscheduleitem.php
├── erlhcoreclassmodelfbpage.php
├── erlhcoreclassmodelmyfbpage.php
└── livehelperchatextension
│ └── fbmessenger
│ └── providers
│ ├── erlhcoreclassmodelmessagefbwhatsappaccount.php
│ ├── erlhcoreclassmodelmessagefbwhatsappcampaign.php
│ ├── erlhcoreclassmodelmessagefbwhatsappcampaignrecipient.php
│ ├── erlhcoreclassmodelmessagefbwhatsappcontact.php
│ ├── erlhcoreclassmodelmessagefbwhatsappcontactlist.php
│ ├── erlhcoreclassmodelmessagefbwhatsappcontactlistcontact.php
│ └── erlhcoreclassmodelmessagefbwhatsappmessage.php
├── providers
├── FBMessengerInstagramAppLiveHelperChatActivator.php
├── FBMessengerMessengerAppLiveHelperChatActivator.php
├── FBMessengerWhatsAppLiveHelperChat.php
├── FBMessengerWhatsAppLiveHelperChatActivator.php
├── FBMessengerWhatsAppMailingValidator.php
├── FBMessengerWhatsAppMailingWorker.php
├── erLhcoreClassModelMessageFBWhatsAppAccount.php
├── erLhcoreClassModelMessageFBWhatsAppAccountValidator.php
├── erLhcoreClassModelMessageFBWhatsAppCampaign.php
├── erLhcoreClassModelMessageFBWhatsAppCampaignRecipient.php
├── erLhcoreClassModelMessageFBWhatsAppContact.php
├── erLhcoreClassModelMessageFBWhatsAppContactList.php
├── erLhcoreClassModelMessageFBWhatsAppContactListContact.php
└── erLhcoreClassModelMessageFBWhatsAppMessage.php
├── settings
└── settings.ini.default.php
└── translations
└── lt_LT
└── translation.ts
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [livehelperchat]
4 |
--------------------------------------------------------------------------------
/.github/SECURITY.md:
--------------------------------------------------------------------------------
1 | Security issues should be reported directly to me to remdex@gmail.com or info@livehelperchat.com. You can also just ping me on discord server https://discord.gg/YsZXQVh
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | settings/settings.ini.php
2 | composer.phar
3 | composer-setup.php
4 | modules/lhcron/check_integrations.php
--------------------------------------------------------------------------------
/classes/erlhcoreclassmodelfbnotificationschedulecampaign.php:
--------------------------------------------------------------------------------
1 | $this->id,
19 | 'schedule_id' => $this->schedule_id,
20 | 'status' => $this->status,
21 | 'last_id' => $this->last_id,
22 | 'ctime' => $this->ctime,
23 | 'last_send' => $this->last_send,
24 | );
25 | }
26 |
27 | public function __toString()
28 | {
29 | return $this->schedule_id;
30 | }
31 |
32 | public function __get($var)
33 | {
34 | switch ($var) {
35 |
36 | case 'dep':
37 | $this->dep = erLhcoreClassModelDepartament::fetch($this->dep_id);
38 | return $this->dep;
39 | break;
40 |
41 | case 'ctime_front':
42 | $this->ctime_front = date('Ymd') == date('Ymd',$this->ctime) ? date(erLhcoreClassModule::$dateHourFormat,$this->ctime) : date(erLhcoreClassModule::$dateDateHourFormat,$this->ctime);
43 | return $this->ctime_front;
44 | break;
45 |
46 | default:
47 | ;
48 | break;
49 | }
50 | }
51 |
52 | const STATUS_PENDING = 0;
53 | const STATUS_COLLECTING = 1;
54 | const STATUS_COLLECTED = 2;
55 | const STATUS_SENDING = 3;
56 | const STATUS_SEND = 4;
57 |
58 | public $id = null;
59 | public $schedule_id = 0;
60 | public $status = 0;
61 | public $last_id = 0;
62 | public $ctime = 0;
63 | public $last_send = 0;
64 |
65 | }
66 |
67 | ?>
--------------------------------------------------------------------------------
/classes/erlhcoreclassmodelfbnotificationscheduleitem.php:
--------------------------------------------------------------------------------
1 | $this->id,
19 | 'schedule_id' => $this->schedule_id,
20 | 'status' => $this->status,
21 | 'lead_id' => $this->lead_id,
22 | 'campaign_id' => $this->campaign_id,
23 | 'send_time' => $this->send_time,
24 | 'log' => $this->log,
25 | );
26 | }
27 |
28 | public function __toString()
29 | {
30 | return $this->lead_id;
31 | }
32 |
33 | public function __get($var)
34 | {
35 | switch ($var) {
36 |
37 | case 'dep':
38 | $this->dep = erLhcoreClassModelDepartament::fetch($this->dep_id);
39 | return $this->dep;
40 | break;
41 |
42 | default:
43 | ;
44 | break;
45 | }
46 | }
47 |
48 | const STATUS_PENDING = 0;
49 | const STATUS_PROCESSED = 1;
50 | const STATUS_ERROR = 2;
51 |
52 | public $id = null;
53 | public $schedule_id = 0;
54 | public $status = 0;
55 | public $lead_id = 0;
56 | public $campaign_id = 0;
57 | public $send_time = 0;
58 | public $log = '';
59 | }
60 |
61 | ?>
--------------------------------------------------------------------------------
/classes/erlhcoreclassmodelfbpage.php:
--------------------------------------------------------------------------------
1 | $this->id,
19 | 'dep_id' => $this->dep_id,
20 | 'page_id' => $this->page_id,
21 | 'page_token' => $this->page_token,
22 | 'verify_token' => $this->verify_token,
23 | 'app_secret' => $this->app_secret,
24 | 'name' => $this->name,
25 | 'verified' => $this->verified,
26 | 'bot_disabled' => $this->bot_disabled
27 | );
28 | }
29 |
30 | public function __toString()
31 | {
32 | return $this->name;
33 | }
34 |
35 | public function __get($var)
36 | {
37 | switch ($var) {
38 |
39 | case 'callback_url':
40 | $this->callback_url = erLhcoreClassXMP::getBaseHost() . $_SERVER['HTTP_HOST'] . erLhcoreClassDesign::baseurldirect('fbmessenger/callback') . '/' . $this->id;
41 | return $this->callback_url;
42 |
43 | case 'access_token':
44 | $this->access_token = $this->page_token;
45 | return $this->access_token;
46 |
47 | default:
48 | ;
49 | break;
50 | }
51 | }
52 |
53 | /**
54 | * Delete page chat's
55 | */
56 | public function beforeRemove()
57 | {
58 | $q = ezcDbInstance::get()->createDeleteQuery();
59 | $q->deleteFrom('lhc_fbmessenger_chat')->where($q->expr->eq('page_id', $this->id));
60 | $stmt = $q->prepare();
61 | $stmt->execute();
62 | }
63 |
64 | public $id = null;
65 | public $dep_id = null;
66 | public $page_token = null;
67 | public $verify_token = null;
68 | public $app_secret = null;
69 | public $name = '';
70 | public $verified = 0;
71 | public $bot_disabled = 0;
72 | public $page_id = 0;
73 | }
74 |
75 | ?>
--------------------------------------------------------------------------------
/classes/filter.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'name',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldSortAttr = array (
18 | 'field' => false,
19 | 'default' => false,
20 | 'serialised' => true,
21 | 'disabled' => true,
22 | 'options' => array()
23 | );
24 |
25 | return array(
26 | 'filterAttributes' => $fieldsSearch,
27 | 'sortAttributes' => $fieldSortAttr
28 | );
--------------------------------------------------------------------------------
/classes/filter/account.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Department',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'filterin',
11 | 'filter_table_field' => 'dep_id',
12 | 'validation_definition' => new ezcInputFormDefinitionElement(
13 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0), FILTER_REQUIRE_ARRAY
14 | )
15 | );
16 |
17 | $fieldsSearch['sortby'] = array (
18 | 'type' => 'text',
19 | 'trans' => 'Sort by',
20 | 'required' => false,
21 | 'valid_if_filled' => false,
22 | 'filter_type' => false,
23 | 'filter_table_field' => 'user_id',
24 | 'validation_definition' => new ezcInputFormDefinitionElement(
25 | ezcInputFormDefinitionElement::OPTIONAL, 'string')
26 | );
27 |
28 | $fieldSortAttr = array (
29 | 'field' => 'sortby',
30 | 'default' => 'iddesc',
31 | 'serialised' => true,
32 | 'options' => array(
33 | 'iddesc' => array('sort_column' => 'id DESC'),
34 | 'idasc' => array('sort_column' => 'id ASC')
35 | )
36 | );
37 |
38 | return array(
39 | 'filterAttributes' => $fieldsSearch,
40 | 'sortAttributes' => $fieldSortAttr
41 | );
42 |
43 | return array(
44 | 'filterAttributes' => $fieldsSearch,
45 | 'sortAttributes' => $fieldSortAttr
46 | );
--------------------------------------------------------------------------------
/classes/filter/bbcode.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'name',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldSortAttr = array (
18 | 'field' => false,
19 | 'default' => false,
20 | 'serialised' => true,
21 | 'disabled' => true,
22 | 'options' => array()
23 | );
24 |
25 | return array(
26 | 'filterAttributes' => $fieldsSearch,
27 | 'sortAttributes' => $fieldSortAttr
28 | );
--------------------------------------------------------------------------------
/classes/filter/campaign.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'name',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldsSearch['user_ids'] = array (
18 | 'type' => 'text',
19 | 'trans' => 'Department',
20 | 'required' => false,
21 | 'valid_if_filled' => false,
22 | 'filter_type' => 'filterin',
23 | 'filter_table_field' => 'user_id',
24 | 'validation_definition' => new ezcInputFormDefinitionElement(
25 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0), FILTER_REQUIRE_ARRAY
26 | )
27 | );
28 |
29 | $fieldsSearch['timefrom'] = array (
30 | 'type' => 'text',
31 | 'trans' => 'Timefrom',
32 | 'required' => false,
33 | 'valid_if_filled' => false,
34 | 'datatype' => 'datetime',
35 | 'filter_type' => 'filtergte',
36 | 'filter_table_field' => 'starts_at',
37 | 'validation_definition' => new ezcInputFormDefinitionElement (
38 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
39 | )
40 | );
41 |
42 | $fieldsSearch['timeto'] = array (
43 | 'type' => 'text',
44 | 'trans' => 'Timeto',
45 | 'required' => false,
46 | 'valid_if_filled' => false,
47 | 'datatype' => 'datetime',
48 | 'filter_type' => 'filterlte',
49 | 'filter_table_field' => 'starts_at',
50 | 'validation_definition' => new ezcInputFormDefinitionElement (
51 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
52 | )
53 | );
54 |
55 | $fieldSortAttr = array (
56 | 'field' => false,
57 | 'default' => false,
58 | 'serialised' => true,
59 | 'disabled' => true,
60 | 'options' => array()
61 | );
62 |
63 | return array(
64 | 'filterAttributes' => $fieldsSearch,
65 | 'sortAttributes' => $fieldSortAttr
66 | );
--------------------------------------------------------------------------------
/classes/filter/campaign_recipient.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'name',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldsSearch['campaign'] = array (
18 | 'type' => 'text',
19 | 'trans' => 'Name',
20 | 'required' => false,
21 | 'valid_if_filled' => false,
22 | 'filter_type' => 'filter',
23 | 'filter_table_field' => 'campaign_id',
24 | 'validation_definition' => new ezcInputFormDefinitionElement (
25 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 1)
26 | )
27 | );
28 |
29 | $fieldsSearch['status'] = array (
30 | 'type' => 'text',
31 | 'trans' => 'Name',
32 | 'required' => false,
33 | 'valid_if_filled' => false,
34 | 'filter_type' => 'filter',
35 | 'filter_table_field' => 'status',
36 | 'validation_definition' => new ezcInputFormDefinitionElement (
37 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0)
38 | )
39 | );
40 |
41 | $fieldsSearch['opened'] = array (
42 | 'type' => 'text',
43 | 'trans' => 'Name',
44 | 'required' => false,
45 | 'valid_if_filled' => false,
46 | 'filter_type' => 'manual',
47 | 'filter_table_field' => ['customfilter' => ['(`opened_at` > 0)']],
48 | 'filter_table_by_value' => [
49 | 0 => ['customfilter' => ['(`opened_at` = 0)']],
50 | 1 => ['customfilter' => ['(`opened_at` > 0)']],
51 | ],
52 | 'validation_definition' => new ezcInputFormDefinitionElement (
53 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0, 'max_range' => 1)
54 | )
55 | );
56 |
57 | $fieldSortAttr = array (
58 | 'field' => false,
59 | 'default' => false,
60 | 'serialised' => true,
61 | 'disabled' => true,
62 | 'options' => array()
63 | );
64 |
65 | return array(
66 | 'filterAttributes' => $fieldsSearch,
67 | 'sortAttributes' => $fieldSortAttr
68 | );
--------------------------------------------------------------------------------
/classes/filter/leads.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'name',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldSortAttr = array (
18 | 'field' => false,
19 | 'default' => false,
20 | 'serialised' => true,
21 | 'disabled' => true,
22 | 'options' => array()
23 | );
24 |
25 | return array(
26 | 'filterAttributes' => $fieldsSearch,
27 | 'sortAttributes' => $fieldSortAttr
28 | );
--------------------------------------------------------------------------------
/classes/filter/mailbox.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'name',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldsSearch['user_ids'] = array (
18 | 'type' => 'text',
19 | 'trans' => 'Department',
20 | 'required' => false,
21 | 'valid_if_filled' => false,
22 | 'filter_type' => 'filterin',
23 | 'filter_table_field' => 'user_id',
24 | 'validation_definition' => new ezcInputFormDefinitionElement(
25 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0), FILTER_REQUIRE_ARRAY
26 | )
27 | );
28 |
29 | $fieldsSearch['timefrom'] = array (
30 | 'type' => 'text',
31 | 'trans' => 'Timefrom',
32 | 'required' => false,
33 | 'valid_if_filled' => false,
34 | 'datatype' => 'datetime',
35 | 'filter_type' => 'filtergte',
36 | 'filter_table_field' => 'created_at',
37 | 'validation_definition' => new ezcInputFormDefinitionElement (
38 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
39 | )
40 | );
41 |
42 | $fieldsSearch['timeto'] = array (
43 | 'type' => 'text',
44 | 'trans' => 'Timeto',
45 | 'required' => false,
46 | 'valid_if_filled' => false,
47 | 'datatype' => 'datetime',
48 | 'filter_type' => 'filterlte',
49 | 'filter_table_field' => 'created_at',
50 | 'validation_definition' => new ezcInputFormDefinitionElement (
51 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
52 | )
53 | );
54 |
55 | $fieldSortAttr = array (
56 | 'field' => false,
57 | 'default' => false,
58 | 'serialised' => true,
59 | 'disabled' => true,
60 | 'options' => array()
61 | );
62 |
63 | return array(
64 | 'filterAttributes' => $fieldsSearch,
65 | 'sortAttributes' => $fieldSortAttr
66 | );
--------------------------------------------------------------------------------
/classes/filter/mailing_recipient.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'phone',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldsSearch['delivery_status'] = array (
18 | 'type' => 'text',
19 | 'trans' => 'Chats status',
20 | 'required' => false,
21 | 'valid_if_filled' => false,
22 | 'filter_type' => 'filter',
23 | 'filter_table_field' => 'delivery_status',
24 | 'validation_definition' => new ezcInputFormDefinitionElement(
25 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0,'max_range' => 1000)
26 | )
27 | );
28 |
29 | $fieldsSearch['name'] = array (
30 | 'type' => 'text',
31 | 'trans' => 'Name',
32 | 'required' => false,
33 | 'valid_if_filled' => false,
34 | 'filter_type' => 'like',
35 | 'filter_table_field' => 'name',
36 | 'validation_definition' => new ezcInputFormDefinitionElement (
37 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
38 | )
39 | );
40 |
41 | $fieldsSearch['ml'] = array (
42 | 'type' => 'text',
43 | 'trans' => 'id',
44 | 'required' => false,
45 | 'valid_if_filled' => false,
46 | 'filter_type' => false,
47 | 'filter_table_field' => 'id',
48 | 'validation_definition' => new ezcInputFormDefinitionElement (
49 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0), FILTER_REQUIRE_ARRAY
50 | )
51 | );
52 |
53 | $fieldsSearch['user_ids'] = array (
54 | 'type' => 'text',
55 | 'trans' => 'Department',
56 | 'required' => false,
57 | 'valid_if_filled' => false,
58 | 'filter_type' => 'filterin',
59 | 'filter_table_field' => 'user_id',
60 | 'validation_definition' => new ezcInputFormDefinitionElement(
61 | ezcInputFormDefinitionElement::OPTIONAL, 'int', array( 'min_range' => 0), FILTER_REQUIRE_ARRAY
62 | )
63 | );
64 |
65 | $fieldSortAttr = array (
66 | 'field' => false,
67 | 'default' => false,
68 | 'serialised' => true,
69 | 'disabled' => true,
70 | 'options' => array()
71 | );
72 |
73 | return array(
74 | 'filterAttributes' => $fieldsSearch,
75 | 'sortAttributes' => $fieldSortAttr
76 | );
--------------------------------------------------------------------------------
/classes/filter/notifications.php:
--------------------------------------------------------------------------------
1 | 'text',
7 | 'trans' => 'Name',
8 | 'required' => false,
9 | 'valid_if_filled' => false,
10 | 'filter_type' => 'like',
11 | 'filter_table_field' => 'name',
12 | 'validation_definition' => new ezcInputFormDefinitionElement (
13 | ezcInputFormDefinitionElement::OPTIONAL, 'string'
14 | )
15 | );
16 |
17 | $fieldSortAttr = array (
18 | 'field' => false,
19 | 'default' => false,
20 | 'serialised' => true,
21 | 'disabled' => true,
22 | 'options' => array()
23 | );
24 |
25 | return array(
26 | 'filterAttributes' => $fieldsSearch,
27 | 'sortAttributes' => $fieldSortAttr
28 | );
--------------------------------------------------------------------------------
/design/fbmessengertheme/images/F_icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/images/fblogin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/design/fbmessengertheme/images/fblogin.png
--------------------------------------------------------------------------------
/design/fbmessengertheme/images/instagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/design/fbmessengertheme/images/instagram.png
--------------------------------------------------------------------------------
/design/fbmessengertheme/images/login-fb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/design/fbmessengertheme/images/login-fb.png
--------------------------------------------------------------------------------
/design/fbmessengertheme/images/social/instagram-ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/design/fbmessengertheme/images/social/instagram-ico.png
--------------------------------------------------------------------------------
/design/fbmessengertheme/images/social/messenger-ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/design/fbmessengertheme/images/social/messenger-ico.png
--------------------------------------------------------------------------------
/design/fbmessengertheme/images/social/whatsapp-ico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/design/fbmessengertheme/images/social/whatsapp-ico.png
--------------------------------------------------------------------------------
/design/fbmessengertheme/js/extension.fbwhatsapp.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | $('#template-to-send').change(function() {
3 | $.postJSON(WWW_DIR_JAVASCRIPT + '/fbwhatsapp/rendersend/' + $(this).val() + (typeof businessAccountId !== 'undefined' ? '/' + businessAccountId : ''), {'data': JSON.stringify(messageFieldsValues)}, function(data) {
4 | $('#arguments-template').html(data.preview);
5 | $('#arguments-template-form').html(data.form);
6 | });
7 | });
8 | if ($('#template-to-send').val() != '') {
9 | $.postJSON(WWW_DIR_JAVASCRIPT + '/fbwhatsapp/rendersend/' + $('#template-to-send').val() + (typeof businessAccountId !== 'undefined' ? '/' + businessAccountId : ''), {'data': JSON.stringify(messageFieldsValues)}, function(data) {
10 | $('#arguments-template').html(data.preview);
11 | $('#arguments-template-form').html(data.form);
12 | });
13 | }
14 | $('#id_business_account_id').change(function(){
15 | businessAccountId = $(this).val();
16 | $('#arguments-template').html('');
17 | $('#arguments-template-form').html('');
18 | $('#template-to-send').html('');
19 | $('#id_phone_sender_id').html('');
20 | $.postJSON(WWW_DIR_JAVASCRIPT + '/fbwhatsapp/rendertemplates/' +businessAccountId, function(data) {
21 | $('#template-to-send').html(data.templates);
22 | $('#id_phone_sender_id').html(data.phones);
23 | });
24 | });
25 | })();
26 |
27 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhchat/chat_tabs/information_rows/extension_information_row_multiinclude.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 | chat_variables_array['fb_chat']) && $chat->chat_variables_array['fb_chat'] == true) ||
5 | (is_object($chat->iwh) && in_array($chat->iwh->scope,['facebookmessengerappscope','facebookinstagramappscope']))
6 | ) : ?>
7 |
8 |
9 | getTranslation('chat/adminchat','FB Chat')?>
10 | |
11 |
12 | YESchat_variables_array['fb_gender'])) : ?>, chat_variables_array['fb_gender'])?>
13 | |
14 |
15 | array('user_id' => isset($chat->chat_variables_array['fb_user_id']) ? $chat->chat_variables_array['fb_user_id'] : $chat->incoming_chat->chat_external_first)));
17 | if ($fbLead instanceof erLhcoreClassModelFBLead) : $fbNotification = erLhcoreClassModelFBNotificationScheduleItem::findOne(array('filter' => array('lead_id' => $fbLead->id,'status' => 1)));
18 | if ($fbNotification instanceof erLhcoreClassModelFBNotificationScheduleItem) : $fbSchedule = erLhcoreClassModelFBNotificationSchedule::fetch($fbNotification->schedule_id);
19 | if ($fbSchedule instanceof erLhcoreClassModelFBNotificationSchedule) : ?>
20 |
21 |
22 | getTranslation('chat/adminchat','Last marketing message')?>
23 | message));?>
24 | |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhchat/chat_tabs/information_rows/information_order_extension_multiinclude.tpl.php:
--------------------------------------------------------------------------------
1 |
7 |
8 | 'fb_chat',
11 | 'enabled' => true
12 | );
13 | ?>
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/chat_profile.tpl.php:
--------------------------------------------------------------------------------
1 | chat_variables_array;
3 | if (is_object($chat->iwh) && in_array($chat->iwh->scope,['facebookmessengerappscope','facebookinstagramappscope']) && is_object($chat->incoming_chat)) :
4 | $fbLead = erLhcoreClassModelFBLead::findOne(array('filter' => array('user_id' => isset($chat->chat_variables_array['fb_user_id']) ? $chat->chat_variables_array['fb_user_id'] : $chat->incoming_chat->chat_external_first)));
5 | if ($fbLead instanceof erLhcoreClassModelFBLead) : ?>
6 |
first_name) ?> last_name) ?>
7 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/edit.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Edit facebook page');?>
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/editnotification.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Edit notification');?>
2 |
3 |
4 |
5 |
6 |
7 | getTranslation('user/account','Updated!'); ?>
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/list.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Facebook pages list');?>
2 |
3 |
4 |
5 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | getTranslation('module/fbmessenger','Register new page');?>
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/new.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','New facebook page');?>
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/newnotification.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','New notification');?>
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/notifications.tpl.php:
--------------------------------------------------------------------------------
1 | feature_2_supported == 1;?>
2 |
3 |
4 |
5 |
6 |
7 | getTranslation('module/fbmessenger','Facebook notifications list');?>
8 |
9 |
10 |
11 |
12 |
13 |
14 | getTranslation('module/fbmessenger','Name');?> |
15 | |
16 |
17 |
18 |
19 |
20 | name)?> |
21 |
22 |
26 | |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | getTranslation('module/fbmessenger','New notification');?>
40 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/pagesubscribe.tpl.php:
--------------------------------------------------------------------------------
1 | Page subscription
2 |
3 |
4 |
5 |
6 |
7 | getTranslation('user/account','You have successfully subscribed'); ?>
8 |
9 |
10 |
11 | getTranslation('user/account','You have successfully un-subscribed'); ?>
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | My pages
20 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/parts/form.tpl.php:
--------------------------------------------------------------------------------
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 | 'dep_id',
38 | 'optional_field' => erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Select department'),
39 | 'selected_id' => $item->dep_id,
40 | 'css_class' => 'form-control',
41 | 'list_function' => 'erLhcoreClassModelDepartament::getList',
42 | 'list_function_params' => array(),
43 | )); ?>
44 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/parts/form_channel.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbmessenger/whatsappsubscribe.tpl.php:
--------------------------------------------------------------------------------
1 | WhatsApp subscription
2 |
3 |
4 |
5 |
6 |
7 | getTranslation('user/account','You have successfully subscribed'); ?>
8 |
9 |
10 |
11 | getTranslation('user/account','You have successfully un-subscribed'); ?>
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | My pages
20 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/account.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Business Accounts');?>
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | getTranslation('module/fbmessenger','ID');?> |
10 | getTranslation('module/fbmessenger','Name');?> |
11 | getTranslation('module/fbmessenger','Department');?> |
12 | getTranslation('module/fbmessenger','Account ID');?> |
13 | |
14 |
15 |
16 |
17 |
18 |
19 | id?>
20 | |
21 |
22 | send
23 | forum
24 | editname)?>
25 | |
26 |
27 | department)?>
28 | |
29 |
30 | business_account_id?>
31 | |
32 |
33 | delete
34 | |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | getTranslation('module/fbmessenger','New business account');?>
47 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/editaccount.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Edit Business Account');?>
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/newaccount.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','New Business Account');?>
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/parts/form_filter_ccount.tpl.php:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/design/fbmessengertheme/tpl/lhfbwhatsapp/parts/form_filter_ccount.tpl.php
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/quickstats.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('chat/lists/search_panel','Quick stats');
4 | $modalSize = 'ml';
5 | $modalBodyClass = 'p-1';
6 | $appendPrintExportURL = '';
7 | ?>
8 |
9 |
10 |
11 |
12 |
13 |
14 |
getTranslation('module/fbmessenger','Sent')?>
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
name)?>
23 | ['status' => $statVariation->id]])); ?>
24 |
25 |
26 |
27 |
28 |
29 |
32 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/rawjson.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Message preview');
4 | $modalSize = 'lg';
5 | $modalBodyClass = 'p-1'
6 | ?>
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/rendertemplates.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsapp/templates.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Templates'); ?>
2 |
3 |
4 |
5 |
6 |
7 |
8 | |
9 |
10 |
11 | |
12 |
13 |
14 | |
15 |
16 |
17 | |
18 |
19 |
20 | |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/detailssend.tpl.php:
--------------------------------------------------------------------------------
1 |
2 | getTranslation('chat/lists/search_panel','Details send');
5 | $modalSize = 'xl';
6 | $modalBodyClass = 'p-1';
7 | $appendPrintExportURL = '';
8 | ?>
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/editmailinglist.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('module/fbmessenger','Edit');?>, getTranslation('module/fbmessenger','Created at');?> - created_at_front?>
2 |
3 | getTranslation('module/fbmessenger','Updated'); ?>
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/editmailingrecipient.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('chat/lists/search_panel','Edit recipient');
4 | $modalSize = 'xl';
5 | $modalBodyClass = 'p-1';
6 | $appendPrintExportURL = '';
7 | ?>
8 |
9 |
10 |
11 |
38 |
39 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/newcampaign.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/newcampaignrecipient.tpl.php:
--------------------------------------------------------------------------------
1 |
2 | getTranslation('chat/lists/search_panel','New recipient');
5 | $modalSize = 'xl';
6 | $modalBodyClass = 'p-1';
7 | $appendPrintExportURL = '';
8 | ?>
9 |
10 |
11 |
12 |
43 |
44 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/newmailinglist.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/newmailingrecipient.tpl.php:
--------------------------------------------------------------------------------
1 | getTranslation('chat/lists/search_panel','New recipient');
4 | $modalSize = 'xl';
5 | $modalBodyClass = 'p-1';
6 | $appendPrintExportURL = '';
7 | ?>
8 |
9 |
10 |
11 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfbwhatsappmessaging/parts/form_mailing_list.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhfront/dashboard/panels/bodies/custom_title_multiinclude.tpl.php:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/lhinstance/features_multiinclude.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/design/fbmessengertheme/tpl/pagelayouts/parts/modules_menu/extension_module_multiinclude.tpl.php:
--------------------------------------------------------------------------------
1 | hasAccessTo('lhfbmessenger','use_admin')) : ?>
2 | commentgetTranslation('module/fbmessenger','Facebook chat');?>
3 |
--------------------------------------------------------------------------------
/doc/access_token.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/doc/access_token.png
--------------------------------------------------------------------------------
/doc/changelog.txt:
--------------------------------------------------------------------------------
1 | 1.3v
2 |
3 | 1. Option to schedule campaigns
4 | To have campaigns running you need to have these cronjobs running.
5 | Every minute. Schedules campaign if found.
6 | php cron.php -s site_admin -e fbmessenger -c cron/schedule_compaign
7 |
8 | Every minute. Collects recipients
9 | php cron.php -s site_admin -e fbmessenger -c cron/collect_recipients
10 |
11 | Every minute or more frequent. Sends notifications.
12 | php cron.php -s site_admin -e fbmessenger -c cron/send_notification
13 |
14 | 1.2v
15 | 1. Option to login with facebook account. To automate new pages addign to extension without requirement to create app for each page.
16 | Address for callback should be
17 | https:///fbmessenger/callbackgeneral
18 | In settings file put
19 | 'app_settings' => array (
20 | 'app_id' => '',
21 | 'app_secret' => '',
22 | 'verify_token' => '',
23 | )
24 |
25 | 1.1v
26 | 1. Options to have buttons as bbcodes
27 |
28 | 1.0v
29 | Initial release
30 |
--------------------------------------------------------------------------------
/doc/contact.csv:
--------------------------------------------------------------------------------
1 | phone,phone_recipient,status,email,name,title,lastname,company,date,attr_str_1,attr_str_2,attr_str_3,attr_str_4,attr_str_5,attr_str_6,file_1,file_2,file_3,file_4
2 | 37065111111,370865111111,active,info@livehelperchat.com,Remigijus,Developer,Kiminas,Live Helper Chat,1983-11-05T03:00,attr_str_1 ,attr_str_2 ,attr_str_3 ,attr_str_4 ,attr_str_5 ,attr_str_6 ,https://livehelperchat.com/design/frontendnew/images/lhc.png,https://livehelperchat.com/design/frontendnew/images/lhc.png,https://livehelperchat.com/design/frontendnew/images/lhc.png,https://livehelperchat.com/design/frontendnew/images/lhc.png
--------------------------------------------------------------------------------
/doc/instagram/bot-data.json:
--------------------------------------------------------------------------------
1 | {"bot":{"name":"FacebookInstagramApp"},"groups":[{"group":{"name":"New group","is_collapsed":0,"pos":0},"triggers":[{"trigger":{"id":2037,"name":"Default","actions":"[{\"_id\":\"CNWiE4iq_\",\"type\":\"restapi\",\"content\":{\"text\":\"\",\"rest_api\":76,\"rest_api_method\":\"temp1628483419328\",\"rest_api_method_params\":[],\"rest_api_method_output\":{\"default_trigger\":\"2038\"},\"attr_options\":{\"as_system\":false,\"no_body\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2038,"name":"Debug","actions":"[{\"_id\":\"nUbSXpW6w\",\"type\":\"text\",\"content\":{\"text\":\"{http_code}\\n{http_error}\\n{content_raw}\\n{http_data}\",\"attr_options\":{\"as_system\":false,\"as_log_msg\":true}},\"skip_resp\":false},{\"_id\":\"CJ_TgN4PG\",\"type\":\"text\",\"content\":{\"text\":\"There was an error with sending your message. Please check audit log for more information.\",\"attr_options\":{\"as_system\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]}]}]}
--------------------------------------------------------------------------------
/doc/instagram/chat.before_auto_responder_msg_saved.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.before_auto_responder_msg_saved",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookinstagramappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/instagram/chat.desktop_client_admin_msg.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.desktop_client_admin_msg",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookinstagramappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/instagram/chat.web_add_msg_admin.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.web_add_msg_admin",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookinstagramappscope\"},{\"_id\":\"JWGRJ01s5M\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.last_message.meta_msg_array.content.whisper}\",\"condition\":\"neq\",\"value\":\"1\"},{\"_id\":\"JWGRJ0ss5M\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.last_message.user_id}\",\"condition\":\"neq\",\"value\":\"-1\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/instagram/chat.workflow.canned_message_before_save.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.workflow.canned_message_before_save",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookinstagramappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/instagram/rest-api.json:
--------------------------------------------------------------------------------
1 | {"name":"FacebookInstagramApp","description":"Instagram & Facebook Official","configuration":"{\"host\":\"\",\"ecache\":false,\"parameters\":[{\"method\":\"POST\",\"authorization\":\"\",\"api_key_location\":\"header\",\"query\":[],\"header\":[],\"conditions\":[],\"postparams\":[],\"userparams\":[],\"output\":[{\"key\":\"\",\"value\":\"\",\"id\":\"temp1725529985736\",\"success_name\":\"Success\",\"success_header\":\"200\",\"success_location\":\"__all__\"}],\"id\":\"temp1628483419328\",\"remote_message_id\":\"message_id\",\"name\":\"Send message\",\"suburl\":\"{{args.chat.incoming_chat.incoming.attributes.host}}{{args.chat.incoming_chat.incoming.attributes.page_id}}\/messages\/?access_token={{args.chat.incoming_chat.incoming.attributes.access_token}}\",\"auth_api_key_name\":\"AccessKey\",\"auth_api_key_key\":\"\",\"body_request_type\":\"raw\",\"body_request_type_content\":\"json\",\"body_raw\":\"{\\n \\\"recipient\\\":{\\n \\\"id\\\":{{args.chat.incoming_chat.chat_external_first}}\\n },\\n \\\"messaging_type\\\": \\\"RESPONSE\\\",\\n \\\"message\\\":{\\n {plain_api}\\\"text\\\":{{msg_url}}{\/plain_api}\\n {interactive_api}\\\"text\\\":{{msg_url}},\\n\\\"quick_replies\\\":[\\n{button_template}\\n {\\n \\\"content_type\\\":\\\"text\\\",\\n \\\"payload\\\": {{button_payload}},\\n \\\"title\\\": {{button_title}} \\n }\\n{\/button_template}\\n ]\\n{\/interactive_api}\\n\\n{buttons_generic}\\n\\\"attachment\\\":{\\n \\\"type\\\":\\\"template\\\",\\n \\\"payload\\\":{\\n \\\"template_type\\\":\\\"button\\\",\\n \\\"text\\\":{{msg_url}},\\n \\\"buttons\\\":[\\n\\n{button_template_generic}{\\n\\n{trigger_btn_payload}\\n \\\"type\\\":\\\"postback\\\",\\n \\\"payload\\\":{{button_payload}},\\n{\/trigger_btn_payload}\\n\\n{url_btn_payload}\\n \\\"type\\\":\\\"web_url\\\",\\n \\\"url\\\":{{button_payload}},\\n \\\"webview_height_ratio\\\": \\\"full\\\",\\n{\/url_btn_payload}\\n\\n\\n \\\"title\\\": {{button_title}} \\n }{\/button_template_generic}\\n\\n\\n ]\\n }\\n }\\n{\/buttons_generic}\\n }\\n}\",\"suburl_file\":\"{{args.chat.incoming_chat.incoming.attributes.host}}{{args.chat.incoming_chat.chat_external_last}}\/messages\/?access_token={{args.chat.incoming_chat.incoming.attributes.access_token}}\",\"body_raw_file\":\"{\\n \\\"recipient\\\":{\\n \\\"id\\\":{{args.chat.incoming_chat.chat_external_first}}\\n },\\n\\\"message\\\":{\\n \\\"attachment\\\":{\\n \\\"type\\\":\\\"{api_by_ext__mp3_wav_ogg}audio{\/api_by_ext}{api_by_ext__mp4}video{\/api_by_ext}{file_api}file{\/file_api}{image_api}image{\/image_api}\\\", \\n \\\"payload\\\":{\\n \\\"url\\\":{{file_url}}\\n }\\n }\\n }\\n}\"}]}"}
--------------------------------------------------------------------------------
/doc/messenger/bot-data.json:
--------------------------------------------------------------------------------
1 | {"bot":{"name":"FacebookMessengerApp"},"groups":[{"group":{"name":"New group","is_collapsed":0,"pos":0},"triggers":[{"trigger":{"id":2011,"name":"Default","actions":"[{\"_id\":\"CNWiE4iq_\",\"type\":\"restapi\",\"content\":{\"text\":\"\",\"rest_api\":72,\"rest_api_method\":\"temp1628483419328\",\"rest_api_method_params\":[],\"rest_api_method_output\":{\"default_trigger\":\"2012\"},\"attr_options\":{\"as_system\":false,\"no_body\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":2012,"name":"Debug","actions":"[{\"_id\":\"nUbSXpW6w\",\"type\":\"text\",\"content\":{\"text\":\"{http_code}\\n{http_error}\\n{content_raw}\\n{http_data}\",\"attr_options\":{\"as_system\":false,\"as_log_msg\":true}},\"skip_resp\":false},{\"_id\":\"CJ_TgN4PG\",\"type\":\"text\",\"content\":{\"text\":\"There was an error with sending your message. Please check audit log for more information.\",\"attr_options\":{\"as_system\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]}]}]}
--------------------------------------------------------------------------------
/doc/messenger/chat.before_auto_responder_msg_saved.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.before_auto_responder_msg_saved",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookmessengerappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/messenger/chat.desktop_client_admin_msg.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.desktop_client_admin_msg",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookmessengerappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/messenger/chat.web_add_msg_admin.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.web_add_msg_admin",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookmessengerappscope\"},{\"_id\":\"JWGRJ01s5M\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.last_message.meta_msg_array.content.whisper}\",\"condition\":\"neq\",\"value\":\"1\"},{\"_id\":\"JWGRJ0ss5M\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.last_message.user_id}\",\"condition\":\"neq\",\"value\":\"-1\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/messenger/chat.workflow.canned_message_before_save.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.workflow.canned_message_before_save",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookmessengerappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/messenger/rest-api.json:
--------------------------------------------------------------------------------
1 | {"name":"FacebookMessengerApp","description":"WhatsApp & Facebook Official","configuration":"{\"host\":\"\",\"ecache\":false,\"parameters\":[{\"method\":\"POST\",\"authorization\":\"\",\"api_key_location\":\"header\",\"query\":[],\"header\":[],\"conditions\":[],\"postparams\":[],\"userparams\":[],\"output\":[{\"key\":\"\",\"value\":\"\",\"id\":\"temp1725528336762\",\"success_name\":\"Success\",\"success_header\":\"200\"}],\"id\":\"temp1628483419328\",\"remote_message_id\":\"message_id\",\"name\":\"Send message\",\"suburl\":\"{{args.chat.incoming_chat.incoming.attributes.host}}{{args.chat.incoming_chat.chat_external_last}}\/messages\/?access_token={{args.chat.incoming_chat.incoming.attributes.access_token}}\",\"auth_api_key_name\":\"AccessKey\",\"auth_api_key_key\":\"\",\"body_request_type\":\"raw\",\"body_request_type_content\":\"json\",\"body_raw\":\"{\\n \\\"recipient\\\":{\\n \\\"id\\\":{{args.chat.incoming_chat.chat_external_first}}\\n },\\n \\\"messaging_type\\\": \\\"RESPONSE\\\",\\n \\\"message\\\":{\\n {plain_api}\\\"text\\\":{{msg_url}}{\/plain_api}\\n {interactive_api}\\\"text\\\":{{msg_url}},\\n\\\"quick_replies\\\":[\\n{button_template}\\n {\\n \\\"content_type\\\":\\\"text\\\",\\n \\\"payload\\\": {{button_payload}},\\n \\\"title\\\": {{button_title}} \\n }\\n{\/button_template}\\n ]\\n{\/interactive_api}\\n\\n{buttons_generic}\\n\\\"attachment\\\":{\\n \\\"type\\\":\\\"template\\\",\\n \\\"payload\\\":{\\n \\\"template_type\\\":\\\"button\\\",\\n \\\"text\\\":{{msg_url}},\\n \\\"buttons\\\":[\\n\\n{button_template_generic}{\\n\\n{trigger_btn_payload}\\n \\\"type\\\":\\\"postback\\\",\\n \\\"payload\\\":{{button_payload}},\\n{\/trigger_btn_payload}\\n\\n{url_btn_payload}\\n \\\"type\\\":\\\"web_url\\\",\\n \\\"url\\\":{{button_payload}},\\n \\\"webview_height_ratio\\\": \\\"full\\\",\\n{\/url_btn_payload}\\n\\n\\n \\\"title\\\": {{button_title}} \\n }{\/button_template_generic}\\n\\n\\n ]\\n }\\n }\\n{\/buttons_generic}\\n }\\n}\",\"suburl_file\":\"{{args.chat.incoming_chat.incoming.attributes.host}}{{args.chat.incoming_chat.chat_external_last}}\/messages\/?access_token={{args.chat.incoming_chat.incoming.attributes.access_token}}\",\"body_raw_file\":\"{\\n \\\"recipient\\\":{\\n \\\"id\\\":{{args.chat.incoming_chat.chat_external_first}}\\n },\\n\\\"message\\\":{\\n \\\"attachment\\\":{\\n \\\"type\\\":\\\"{api_by_ext__mp3_wav_ogg}audio{\/api_by_ext}{api_by_ext__mp4}video{\/api_by_ext}{file_api}file{\/file_api}{image_api}image{\/image_api}\\\", \\n \\\"payload\\\":{\\n \\\"url\\\":{{file_url}}\\n }\\n }\\n }\\n}\"}]}"}
--------------------------------------------------------------------------------
/doc/products-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/doc/products-app.png
--------------------------------------------------------------------------------
/doc/webhooks-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/doc/webhooks-app.png
--------------------------------------------------------------------------------
/doc/webhooks.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/doc/webhooks.png
--------------------------------------------------------------------------------
/doc/whatsapp/bot-data.json:
--------------------------------------------------------------------------------
1 | {"bot":{"name":"FacebookWhatsApp"},"groups":[{"group":{"name":"New group","is_collapsed":0,"pos":0},"triggers":[{"trigger":{"id":1645,"name":"Default","actions":"[{\"_id\":\"CNWiE4iq_\",\"type\":\"restapi\",\"content\":{\"text\":\"\",\"rest_api\":41,\"rest_api_method\":\"temp1628483419328\",\"rest_api_method_params\":[],\"rest_api_method_output\":{\"default_trigger\":\"1646\"},\"attr_options\":{\"as_system\":false,\"no_body\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]},{"trigger":{"id":1646,"name":"Debug","actions":"[{\"_id\":\"nUbSXpW6w\",\"type\":\"text\",\"content\":{\"text\":\"{http_code}\\n{http_error}\\n{content_raw}\\n{http_data}\",\"attr_options\":{\"as_system\":false,\"as_log_msg\":true}},\"skip_resp\":false},{\"_id\":\"CJ_TgN4PG\",\"type\":\"text\",\"content\":{\"text\":\"There was an error with sending your message. Please check audit log for more information.\",\"attr_options\":{\"as_system\":true}}}]","default":0,"default_unknown":0,"default_always":0,"default_unknown_btn":0,"as_argument":0,"in_progress":0},"events":[],"payloads":[]}]}]}
--------------------------------------------------------------------------------
/doc/whatsapp/chat.before_auto_responder_msg_saved.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.before_auto_responder_msg_saved",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookwhatsappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/whatsapp/chat.desktop_client_admin_msg.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.desktop_client_admin_msg",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookwhatsappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/whatsapp/chat.web_add_msg_admin.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.web_add_msg_admin",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookwhatsappscope\"},{\"_id\":\"JWGRJ01s5M\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.last_message.meta_msg_array.content.whisper}\",\"condition\":\"neq\",\"value\":\"1\"},{\"_id\":\"JWGRJ0ss5M\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.last_message.user_id}\",\"condition\":\"neq\",\"value\":\"-1\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/whatsapp/chat.workflow.canned_message_before_save.json:
--------------------------------------------------------------------------------
1 | {
2 | "event": "chat.workflow.canned_message_before_save",
3 | "bot_id": 134,
4 | "trigger_id": 1387,
5 | "trigger_id_alt": 0,
6 | "bot_id_alt": 0,
7 | "disabled": 0,
8 | "type": 0,
9 | "configuration": "[{\"_id\":\"our3swSF4N\",\"type\":\"3\",\"logic\":\"and\",\"attr\":\"{args.chat.incoming_chat.incoming.scope}\",\"condition\":\"eq\",\"value\":\"facebookwhatsappscope\"}]"
10 | }
--------------------------------------------------------------------------------
/doc/whatsapp/rest-api.json:
--------------------------------------------------------------------------------
1 | {"name":"FacebookWhatsApp","description":"WhatsApp & Facebook Official","configuration":"{\"host\":\"\",\"ecache\":false,\"parameters\":[{\"method\":\"POST\",\"authorization\":\"\",\"api_key_location\":\"header\",\"query\":[],\"header\":[{\"key\":\"Authorization\",\"value\":\"Bearer {{args.chat.incoming_chat.incoming.attributes.access_token}}\",\"id\":\"temp1628483840794\"}],\"conditions\":[],\"postparams\":[],\"userparams\":[],\"output\":[{\"key\":\"\",\"value\":\"\",\"id\":\"temp1725531746994\",\"success_name\":\"Success\",\"success_header\":\"200\",\"success_location\":\"__all__\"}],\"id\":\"temp1628483419328\",\"remote_message_id\":\"messages:0:id\",\"name\":\"Send message\",\"suburl\":\"{{args.chat.incoming_chat.incoming.attributes.host}}{{args.chat.chat_variables_array.iwh_field_2}}\/messages\/\",\"auth_api_key_name\":\"AccessKey\",\"auth_api_key_key\":\"\",\"body_request_type\":\"raw\",\"body_request_type_content\":\"json\",\"body_raw\":\"{\\\"messaging_product\\\":\\\"whatsapp\\\", \\\"recipient_type\\\":\\\"individual\\\",\\\"type\\\":\\\"{plain_api}text{\/plain_api}{buttons_generic}interactive{\/buttons_generic}{interactive_api}interactive{\/interactive_api}\\\",\\\"to\\\":{{args.chat.incoming_chat.chat_external_first}} ,\\\"preview_url\\\":\\\"false\\\"\\n\\n{buttons_generic}\\n,\\\"interactive\\\": {\\n \\\"type\\\": \\\"list\\\",\\n\\\"body\\\": {\\n \\\"text\\\": {{msg_url}}\\n },\\n \\\"action\\\": {\\n \\\"button\\\": {{button_more_information}},\\n \\\"sections\\\": [\\n{\\n \\\"title\\\":\\\"\\\",\\n \\\"rows\\\": [\\n {button_template_generic}{\\n \\\"id\\\":{{button_payload}},\\n \\\"title\\\": {{button_title}} \\n }{\/button_template_generic}\\n ]\\n }\\n ] \\n }\\n}\\n{\/buttons_generic}\\n\\n{interactive_api}\\n,\\\"interactive\\\": {\\n \\\"type\\\": \\\"button\\\",\\n\\\"body\\\": {\\n \\\"text\\\": {{msg_url}}\\n },\\n \\\"action\\\": {\\n \\\"buttons\\\": [\\n{button_template}\\n {\\n \\\"type\\\": \\\"reply\\\",\\n \\\"reply\\\": {\\n \\\"id\\\": {{button_payload}},\\n \\\"title\\\": {{button_title}} \\n }\\n }\\n{\/button_template}\\n ] \\n }\\n}\\n{\/interactive_api}\\n\\n{reply_to},\\\"context\\\": { \\\"message_id\\\": {{iwh_msg_id}} }{\/reply_to}\\n\\n{plain_api},\\\"text\\\":{\\\"body\\\": {{msg_url}}}{\/plain_api}}\",\"suburl_file\":\"{{args.chat.incoming_chat.incoming.attributes.host}}{{args.chat.chat_variables_array.iwh_field_2}}\/messages\/\",\"body_raw_file\":\"{\\n \\\"type\\\": \\\"{file_api}document{\/file_api}{image_api}image{\/image_api}{api_by_ext__mp3_wav_ogg}audio{\/api_by_ext}\\\",\\n \\\"messaging_product\\\":\\\"whatsapp\\\", \\\"recipient_type\\\":\\\"individual\\\",\\\"to\\\":{{args.chat.incoming_chat.chat_external_first}},\\n \\\"{file_api}document{\/file_api}{image_api}image{\/image_api}{api_by_ext__mp3_wav_ogg}audio{\/api_by_ext}\\\":{{file_api}\\\"filename\\\":{{file_name}},{\/file_api}\\\"link\\\":{{file_url}}}\\n {reply_to},\\\"context\\\": { \\\"message_id\\\": {{iwh_msg_id}} }{\/reply_to}\\n}\"}]}"}
--------------------------------------------------------------------------------
/doc/whatsapp/whats-app-configuration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiveHelperChat/fbmessenger/5fbc2a91d4710adee9632d0d3f24b04252034da9/doc/whatsapp/whats-app-configuration.png
--------------------------------------------------------------------------------
/modules/lhcron/collect_recipients.php:
--------------------------------------------------------------------------------
1 | array('status' => erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_PENDING)));
7 |
8 | foreach ($scheduleCampaigns as $campaign) {
9 | $db = ezcDbInstance::get();
10 |
11 | $db->beginTransaction() ;
12 | $campaign->syncAndLock();
13 | if ($campaign->status != erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_PENDING) {
14 | break;
15 | } else {
16 | $campaign->status = erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_COLLECTING;
17 | $campaign->saveThis();
18 | }
19 | $db->commit();
20 |
21 | $schedule = erLhcoreClassModelFBNotificationSchedule::fetch($campaign->schedule_id);
22 |
23 | $filter = $schedule->filter_array;
24 | $filter['blocked'] = 0;
25 |
26 | $pageLimit = 50;
27 |
28 | for ($i = 0; $i < 1000000; $i++) {
29 | $leads = erLhcoreClassModelFBLead::getList(array('filter' => $filter, 'offset' => 0, 'filtergt' => array('id' => $campaign->last_id), 'limit' => $pageLimit, 'sort' => 'id ASC'));
30 |
31 | if (!empty($leads))
32 | {
33 | end($leads);
34 | $lastLead = current($leads);
35 |
36 | $campaign->last_id = $lastLead->id;
37 | $campaign->saveThis();
38 |
39 | foreach ($leads as $lead) {
40 | $db = ezcDbInstance::get();
41 | $stmt = $db->prepare("INSERT INTO lhc_fbmessenger_notification_schedule_item (lead_id,status,log,schedule_id,campaign_id,send_time) VALUES (:lead_id, 0, '', :schedule_id, :campaign_id, 0)");
42 | $stmt->bindValue( ':lead_id',$lead->id);
43 | $stmt->bindValue( ':schedule_id',$campaign->schedule_id);
44 | $stmt->bindValue( ':campaign_id',$campaign->id);
45 | $stmt->execute();
46 | }
47 |
48 | } else {
49 | $campaign->status = erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_COLLECTED;
50 | $campaign->saveThis();
51 | break;
52 | }
53 | }
54 | }
55 |
56 | ?>
--------------------------------------------------------------------------------
/modules/lhcron/schedule_compaign.php:
--------------------------------------------------------------------------------
1 | array('start_at' => 0), 'filterlt' => array('start_at' => time()), 'filter' => array('status' => erLhcoreClassModelFBNotificationSchedule::STATUS_PENDING)));
8 |
9 | if ($schedule instanceof erLhcoreClassModelFBNotificationSchedule) {
10 |
11 | $db = ezcDbInstance::get();
12 |
13 | $db->beginTransaction() ;
14 |
15 | $schedule->syncAndLock();
16 | $schedule->status = erLhcoreClassModelFBNotificationSchedule::STATUS_PROCESSED;
17 | $schedule->saveThis();
18 |
19 | $db->commit();
20 |
21 | $scheduleCampaign = new erLhcoreClassModelFBNotificationScheduleCampaign();
22 | $scheduleCampaign->schedule_id = $schedule->id;
23 | $scheduleCampaign->ctime = time();
24 | $scheduleCampaign->saveThis();
25 |
26 | echo "Schedule compaign - " . $scheduleCampaign->id,"\n";
27 | } else {
28 | echo "No schedules were found!","\n";
29 | }
30 |
31 | ?>
--------------------------------------------------------------------------------
/modules/lhcron/send_notification.php:
--------------------------------------------------------------------------------
1 | array('status' => erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_COLLECTED)));
8 |
9 | foreach ($scheduleCampaigns as $campaign) {
10 | $db = ezcDbInstance::get();
11 |
12 | $db->beginTransaction() ;
13 | $campaign->syncAndLock();
14 | if ($campaign->status != erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_COLLECTED) {
15 | break;
16 | } else {
17 | $campaign->status = erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_SENDING;
18 | $campaign->saveThis();
19 | }
20 | $db->commit();
21 |
22 | $schedule = erLhcoreClassModelFBNotificationSchedule::fetch($campaign->schedule_id);
23 |
24 | $itemsToSend = array();
25 |
26 | if ($campaign->last_send < (time()-$schedule->interval) ) {
27 |
28 | $items = erLhcoreClassModelFBNotificationScheduleItem::getList(array('limit' => $schedule->amount, 'filter' => array('status' => erLhcoreClassModelFBNotificationScheduleItem::STATUS_PENDING, 'campaign_id' => $campaign->id)));
29 |
30 | if (!empty($items)) {
31 |
32 | foreach ($items as $item) {
33 | $item->status = erLhcoreClassModelFBNotificationScheduleItem::STATUS_PROCESSED;
34 | try {
35 | erLhcoreClassFBValidator::sendNotification(array(
36 | 'item' => & $item,
37 | 'campaign' => $campaign,
38 | 'schedule' => $schedule,
39 | ));
40 | } catch (Exception $e) {
41 | $item->log = $e->getMessage();
42 | $item->status = erLhcoreClassModelFBNotificationScheduleItem::STATUS_ERROR;
43 | }
44 | $item->send_time = time();
45 | $item->saveThis();
46 | }
47 |
48 | if (count($items) == $schedule->amount) {
49 | $campaign->status = erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_COLLECTED;
50 | } else {
51 | $campaign->status = erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_SEND;
52 | }
53 |
54 | } else {
55 | $campaign->status = erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_SEND;
56 | }
57 |
58 | $campaign->last_send = time();
59 | $campaign->saveThis();
60 |
61 | } else {
62 | echo "Timeout has not passed for campaign - " . $campaign->id . "\n";
63 | $campaign->status = erLhcoreClassModelFBNotificationScheduleCampaign::STATUS_COLLECTED;
64 | $campaign->saveThis();
65 | }
66 |
67 | }
68 |
69 | ?>
--------------------------------------------------------------------------------
/modules/lhcron/update_structure.php:
--------------------------------------------------------------------------------
1 | $status) {
12 | $queries = array_merge($queries,$status['queries']);
13 | }
14 |
15 | if (empty($queries)){
16 | echo "No queries to execute found\n";
17 | } else {
18 | echo "The following queries will be executed\nYou have 10 seconds to stop executing these quries\n";
19 | echo implode("\n", $queries)."\n";
20 | sleep(10);
21 |
22 | erLhcoreClassUpdate::doTablesUpdate(json_decode($contentData,true));
23 | echo "Tables were updated";
24 | }
25 |
26 |
27 | ?>
--------------------------------------------------------------------------------
/modules/lhcron/whatsapp_campaign.php:
--------------------------------------------------------------------------------
1 | ['status' => \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaign::STATUS_FINISHED], 'filterlt' => ['starts_at' => time()], 'filter' => ['enabled' => 1]]);
11 |
12 | $cfg = erConfigClassLhConfig::getInstance();
13 | $worker = $cfg->getSetting( 'webhooks', 'worker' );
14 |
15 | foreach ($campaignValid as $campaign) {
16 | if ($worker == 'resque' && class_exists('erLhcoreClassExtensionLhcphpresque')) {
17 | if (erLhcoreClassRedis::instance()->llen('resque:queue:lhc_fbwhatsapp_campaign') <= 4) {
18 | erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionLhcphpresque')->enqueue('lhc_fbwhatsapp_campaign', '\LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingWorker', array('campaign_id' => $campaign->id));
19 | }
20 | } else {
21 | $worker = (new \LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingWorker());
22 | $worker->args['campaign_id'] = $campaign->id;
23 | $worker->perform();
24 | }
25 | }
26 |
27 |
28 |
29 |
30 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/callback.php:
--------------------------------------------------------------------------------
1 | verify_token) {
9 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
10 |
11 | if ($ext->settings['enable_debug'] == true) {
12 | erLhcoreClassLog::write('VERIFIED');
13 | }
14 |
15 | echo $_GET['hub_challenge'];
16 | exit;
17 | }
18 | }
19 |
20 | use Tgallice\FBMessenger\WebhookRequestHandler;
21 |
22 | $webookHandler = new WebhookRequestHandler($fbpage->app_secret,$fbpage->verify_token);
23 |
24 | if (!$webookHandler->isValidCallbackRequest()) {
25 | if ($ext->settings['enable_debug'] == true) {
26 | erLhcoreClassLog::write('INVALID__TOKEN');
27 | }
28 | exit;
29 | }
30 |
31 | ob_start();
32 | // do initial processing here
33 | echo "ok";
34 | header("HTTP/1.1 200 OK");
35 | header('Connection: close');
36 | header('Content-Length: '.ob_get_length());
37 | ob_end_flush();
38 | ob_flush();
39 | flush();
40 | if (session_id()) session_write_close();
41 |
42 | if (function_exists('fastcgi_finish_request')){
43 | fastcgi_finish_request();
44 | }
45 |
46 | $cfg = erConfigClassLhConfig::getInstance();
47 | $db = ezcDbInstance::get();
48 |
49 | erLhcoreClassExtensionFbmessenger::$typePage = 0;
50 |
51 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookmessengerappscope')));
52 | if (!is_object($webhookPresent)) {
53 | \LiveHelperChatExtension\fbmessenger\providers\FBMessengerMessengerAppLiveHelperChatActivator::installOrUpdate(['dep_id' => 0]);
54 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookmessengerappscope')));
55 | }
56 |
57 | $identifier = $webhookPresent->identifier;
58 |
59 | $Params['user_parameters']['identifier'] = $identifier;
60 | include 'modules/lhwebhooks/incoming.php';
61 |
62 | exit();
63 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/callbackgeneral.php:
--------------------------------------------------------------------------------
1 | settings['app_settings']['verify_token']) {
6 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
7 |
8 | if ($ext->settings['enable_debug'] == true) {
9 | erLhcoreClassLog::write('VERIFIED');
10 | }
11 |
12 | echo $_GET['hub_challenge'];
13 | exit;
14 | }
15 | }
16 |
17 | use Tgallice\FBMessenger\WebhookRequestHandler;
18 |
19 | $webookHandler = new WebhookRequestHandler($ext->settings['app_settings']['app_secret'], $ext->settings['app_settings']['verify_token']);
20 |
21 | if (!$webookHandler->isValidCallbackRequest()) {
22 | if ($ext->settings['enable_debug'] == true) {
23 | erLhcoreClassLog::write('INVALID__TOKEN');
24 | }
25 | exit;
26 | }
27 |
28 | $cfg = erConfigClassLhConfig::getInstance();
29 | $db = ezcDbInstance::get();
30 |
31 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookmessengerappscope')));
32 | if (!is_object($webhookPresent)) {
33 | \LiveHelperChatExtension\fbmessenger\providers\FBMessengerMessengerAppLiveHelperChatActivator::installOrUpdate(['dep_id' => 0]);
34 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookmessengerappscope')));
35 | }
36 |
37 | $Params['user_parameters']['identifier'] = $webhookPresent->identifier;
38 | include 'modules/lhwebhooks/incoming.php';
39 |
40 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/callbackinstagram.php:
--------------------------------------------------------------------------------
1 | settings['app_settings']['instagram_verify_token']) {
6 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
7 |
8 | if ($ext->settings['enable_debug'] == true) {
9 | erLhcoreClassLog::write('VERIFIED');
10 | }
11 |
12 | echo $_GET['hub_challenge'];
13 | exit;
14 | }
15 | }
16 |
17 | // Verify request
18 | use Tgallice\FBMessenger\WebhookRequestHandler;
19 |
20 | $webookHandler = new WebhookRequestHandler($ext->settings['app_settings']['app_secret'], $ext->settings['app_settings']['instagram_verify_token']);
21 | if (!$webookHandler->isValidInstagramCallbackRequest()) {
22 | if ($ext->settings['enable_debug'] == true) {
23 | erLhcoreClassLog::write('INVALID__TOKEN' . print_r($ext->settings['app_settings'],true));
24 | }
25 | exit;
26 | }
27 |
28 | $data = json_decode(file_get_contents('php://input'), true);
29 |
30 | // We ignore messages which are reply to story
31 | if (isset($data['entry'][0]['messaging'][0]['message']['reply_to']['story'])) {
32 | exit();
33 | }
34 |
35 |
36 | $cfg = erConfigClassLhConfig::getInstance();
37 | $db = ezcDbInstance::get();
38 |
39 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookinstagramappscope')));
40 | if (!is_object($webhookPresent)) {
41 | \LiveHelperChatExtension\fbmessenger\providers\FBMessengerInstagramAppLiveHelperChatActivator::installOrUpdate(['dep_id' => 0]);
42 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookinstagramappscope')));
43 | }
44 |
45 | $Params['user_parameters']['identifier'] = $webhookPresent->identifier;;
46 | include 'modules/lhwebhooks/incoming.php';
47 | exit();
48 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/callbackstandalone.php:
--------------------------------------------------------------------------------
1 | settings['app_settings']['verify_token']) {
8 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
9 |
10 | if ($ext->settings['enable_debug'] == true) {
11 | erLhcoreClassLog::write('VERIFIED');
12 | }
13 |
14 | echo $_GET['hub_challenge'];
15 | exit;
16 | }
17 | }
18 |
19 | ob_start();
20 | // do initial processing here
21 | echo "ok";
22 | header("HTTP/1.1 200 OK");
23 | header('Connection: close');
24 | header('Content-Length: '.ob_get_length());
25 | ob_end_flush();
26 | ob_flush();
27 | flush();
28 | if(session_id()) session_write_close();
29 |
30 | if (function_exists('fastcgi_finish_request')){
31 | fastcgi_finish_request();
32 | }
33 |
34 | $data = json_decode(file_get_contents('php://input'), true);
35 |
36 |
37 | try {
38 | if (isset($data['entry'][0]['id']) && is_numeric($data['entry'][0]['id'])) {
39 | $db = ezcDbInstance::get();
40 |
41 | $stmt = $db->prepare("SELECT address, instance_id FROM lhc_fbmessenger_standalone_fb_page WHERE page_id = :page_id");
42 | $stmt->bindValue(':page_id', $data['entry'][0]['id']);
43 | $stmt->execute();
44 | $addressInstance = $stmt->fetch(PDO::FETCH_ASSOC);
45 |
46 | if (!empty($addressInstance['address']) || !empty($addressInstance['instance_id'])) {
47 |
48 | if (!empty($addressInstance['address'])) {
49 | $addressInstanceURL = $addressInstance['address'];
50 | } else {
51 | $cfg = erConfigClassLhConfig::getInstance();
52 | $instance = erLhcoreClassModelInstance::fetch($addressInstance['instance_id']);
53 | $addressInstanceURL = $instance->address . '.' . $cfg->getSetting( 'site', 'seller_domain');
54 | }
55 |
56 | erLhcoreClassFBValidator::proxyStandaloneRequest([
57 | 'headers' => [
58 | 'Facebook-API-Version: '.$_SERVER['HTTP_FACEBOOK_API_VERSION'],
59 | 'X-Hub-Signature: '.$_SERVER['HTTP_X_HUB_SIGNATURE']
60 | ],
61 | 'body' => file_get_contents('php://input'),
62 | 'address' => 'https://' . $addressInstanceURL.'/fbmessenger/callbackgeneral'
63 | ]);
64 |
65 | } else {
66 | throw new Exception('Page not found to proxy - ' . json_encode($data));
67 | }
68 | }
69 | } catch (\Exception $e){
70 | if ($ext->settings['enable_debug'] == true) {
71 | erLhcoreClassLog::write(print_r($e->getMessage(),true))."\n";
72 | }
73 | }
74 |
75 | exit();
76 |
77 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/callbackstandaloneinstagram.php:
--------------------------------------------------------------------------------
1 | settings['app_settings']['instagram_verify_token']) {
8 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
9 |
10 | if ($ext->settings['enable_debug'] == true) {
11 | erLhcoreClassLog::write('VERIFIED');
12 | }
13 |
14 | echo $_GET['hub_challenge'];
15 | exit;
16 | }
17 | }
18 |
19 | ob_start();
20 | // do initial processing here
21 | echo "ok";
22 | header("HTTP/1.1 200 OK");
23 | header('Connection: close');
24 | header('Content-Length: '.ob_get_length());
25 | ob_end_flush();
26 | ob_flush();
27 | flush();
28 | if(session_id()) session_write_close();
29 |
30 | if (function_exists('fastcgi_finish_request')){
31 | fastcgi_finish_request();
32 | }
33 |
34 | $data = json_decode(file_get_contents('php://input'), true);
35 |
36 | // We ignore messages which are reply to story
37 | if (isset($data['entry'][0]['messaging'][0]['message']['reply_to']['story'])) {
38 | exit();
39 | }
40 |
41 | try {
42 | if (isset($data['entry'][0]['id']) && is_numeric($data['entry'][0]['id'])) {
43 | $db = ezcDbInstance::get();
44 |
45 | $stmt = $db->prepare("SELECT address, instance_id FROM lhc_fbmessenger_standalone_fb_page WHERE instagram_business_account = :instagram_business_account");
46 | $stmt->bindValue(':instagram_business_account', $data['entry'][0]['id']);
47 | $stmt->execute();
48 | $addressInstance = $stmt->fetch(PDO::FETCH_ASSOC);
49 |
50 | if (!empty($addressInstance['address']) || !empty($addressInstance['instance_id'])) {
51 |
52 | if (!empty($addressInstance['address'])) {
53 | $addressInstanceURL = $addressInstance['address'];
54 | } else {
55 | $cfg = erConfigClassLhConfig::getInstance();
56 | $instance = erLhcoreClassModelInstance::fetch($addressInstance['instance_id']);
57 | $addressInstanceURL = $instance->address . '.' . $cfg->getSetting( 'site', 'seller_domain');
58 | }
59 |
60 | erLhcoreClassFBValidator::proxyStandaloneRequest([
61 | 'headers' => [
62 | 'Facebook-API-Version: '.$_SERVER['HTTP_FACEBOOK_API_VERSION'],
63 | 'X-Hub-Signature: '.$_SERVER['HTTP_X_HUB_SIGNATURE']
64 | ],
65 | 'body' => file_get_contents('php://input'),
66 | 'address' => 'https://'.$addressInstanceURL.'/fbmessenger/callbackinstagram'
67 | ]);
68 |
69 | } else {
70 | throw new Exception('Page not found to proxy - ' . json_encode($data));
71 | }
72 | }
73 | } catch (\Exception $e){
74 | if ($ext->settings['enable_debug'] == true) {
75 | erLhcoreClassLog::write(print_r($e->getMessage(),true));
76 | }
77 | }
78 |
79 | exit();
80 |
81 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/callbackstandalonewhatsapp.php:
--------------------------------------------------------------------------------
1 | settings['app_settings']['whatsapp_verify_token']) {
7 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
8 |
9 | if ($ext->settings['enable_debug'] == true) {
10 | erLhcoreClassLog::write('VERIFIED');
11 | }
12 |
13 | echo $_GET['hub_challenge'];
14 | exit;
15 | }
16 | }
17 |
18 | ob_start();
19 | // do initial processing here
20 | echo "ok";
21 | header("HTTP/1.1 200 OK");
22 | header('Connection: close');
23 | header('Content-Length: '.ob_get_length());
24 | ob_end_flush();
25 | ob_flush();
26 | flush();
27 | if(session_id()) session_write_close();
28 |
29 | if (function_exists('fastcgi_finish_request')){
30 | fastcgi_finish_request();
31 | }
32 |
33 | $data = json_decode(file_get_contents('php://input'), true);
34 |
35 | try {
36 | if (isset($data['entry'][0]['id']) && is_numeric($data['entry'][0]['id'])) {
37 | $db = ezcDbInstance::get();
38 |
39 | $stmt = $db->prepare("SELECT address, instance_id FROM lhc_fbmessenger_standalone_fb_page WHERE whatsapp_business_account_id = :whatsapp_business_account_id");
40 | $stmt->bindValue(':whatsapp_business_account_id', $data['entry'][0]['id']);
41 | $stmt->execute();
42 | $addressInstance = $stmt->fetch(PDO::FETCH_ASSOC);
43 |
44 | if (!empty($addressInstance['address']) || !empty($addressInstance['instance_id'])) {
45 |
46 | if (!empty($addressInstance['address'])) {
47 | $addressInstanceURL = $addressInstance['address'];
48 | } else {
49 | $cfg = erConfigClassLhConfig::getInstance();
50 | $instance = erLhcoreClassModelInstance::fetch($addressInstance['instance_id']);
51 | $addressInstanceURL = $instance->address . '.' . $cfg->getSetting( 'site', 'seller_domain');
52 | }
53 |
54 | erLhcoreClassFBValidator::proxyStandaloneRequest([
55 | 'headers' => [
56 | 'Facebook-API-Version: '.$_SERVER['HTTP_FACEBOOK_API_VERSION'],
57 | 'X-Hub-Signature: '.$_SERVER['HTTP_X_HUB_SIGNATURE']
58 | ],
59 | 'body' => file_get_contents('php://input'),
60 | 'address' => 'https://'.$addressInstanceURL.'/fbmessenger/callbackwhatsapp'
61 | ]);
62 |
63 | } else {
64 | throw new Exception('Page not found to proxy - ' . json_encode($data));
65 | }
66 | }
67 | } catch (\Exception $e){
68 | if ($ext->settings['enable_debug'] == true) {
69 | erLhcoreClassLog::write(print_r($e->getMessage(),true))."\n";
70 | }
71 | }
72 |
73 | exit();
74 |
75 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/callbackwhatsapp.php:
--------------------------------------------------------------------------------
1 | settings['app_settings']['whatsapp_verify_token']) {
6 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
7 |
8 | if ($ext->settings['enable_debug'] == true) {
9 | erLhcoreClassLog::write('VERIFIED WHATSAPP');
10 | }
11 |
12 | echo $_GET['hub_challenge'];
13 | exit;
14 | }
15 | }
16 |
17 | use Tgallice\FBMessenger\WebhookRequestHandler;
18 |
19 | $webookHandler = new WebhookRequestHandler($ext->settings['app_settings']['app_secret'], $ext->settings['app_settings']['whatsapp_verify_token']);
20 |
21 | if (!$webookHandler->isValidWhatsAppCallbackRequest()) {
22 | if ($ext->settings['enable_debug'] == true) {
23 | erLhcoreClassLog::write('INVALID__TOKEN_WHATSAPP' . print_r($ext->settings['app_settings'],true));
24 | }
25 | exit;
26 | }
27 |
28 | ob_start();
29 | // do initial processing here
30 | echo "ok";
31 | header("HTTP/1.1 200 OK");
32 | header('Connection: close');
33 | header('Content-Length: '.ob_get_length());
34 | ob_end_flush();
35 | ob_flush();
36 | flush();
37 | if(session_id()) session_write_close();
38 | fastcgi_finish_request();
39 |
40 | $cfg = erConfigClassLhConfig::getInstance();
41 | $db = ezcDbInstance::get();
42 |
43 | $payloadData = json_decode(file_get_contents("php://input"),true);
44 |
45 | $cfg = erConfigClassLhConfig::getInstance();
46 | $db = ezcDbInstance::get();
47 |
48 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookwhatsappscope')));
49 |
50 | if (!is_object($webhookPresent)) {
51 | \LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppLiveHelperChatActivator::installOrUpdate(['dep_id' => 0]);
52 | $webhookPresent = erLhcoreClassModelChatIncomingWebhook::findOne(array('filter' => array('scope' => 'facebookwhatsappscope')));
53 | }
54 |
55 | $Params['user_parameters']['identifier'] = $webhookPresent->identifier;;
56 | include 'modules/lhwebhooks/incoming.php';
57 |
58 | exit();
59 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/delete.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | try {
9 | $item = erLhcoreClassModelFBPage::fetch( $Params['user_parameters']['id']);
10 | $item->removeThis();
11 |
12 | erLhcoreClassModule::redirect('fbmessenger/list');
13 | exit;
14 |
15 | } catch (Exception $e) {
16 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
17 | $tpl->set('errors',array($e->getMessage()));
18 | $Result['content'] = $tpl->fetch();
19 | }
20 |
21 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/deletelead.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | try {
9 | $item = erLhcoreClassModelFBLead::fetch( $Params['user_parameters']['id']);
10 | $item->removeThis();
11 |
12 | erLhcoreClassModule::redirect('fbmessenger/leads');
13 | exit;
14 |
15 | } catch (Exception $e) {
16 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
17 | $tpl->set('errors',array($e->getMessage()));
18 | $Result['content'] = $tpl->fetch();
19 | }
20 |
21 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/deletenotification.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | try {
9 | $item = erLhcoreClassModelFBNotificationSchedule::fetch( $Params['user_parameters']['id']);
10 | $item->removeThis();
11 |
12 | erLhcoreClassModule::redirect('fbmessenger/notifications');
13 | exit;
14 |
15 | } catch (Exception $e) {
16 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
17 | $tpl->set('errors',array($e->getMessage()));
18 | $Result['content'] = $tpl->fetch();
19 | }
20 |
21 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/disablebot.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
4 | exit;
5 | }
6 |
7 | $page = erLhcoreClassModelMyFBPage::fetch($Params['user_parameters']['page_id']);
8 | $page->bot_disabled = $Params['user_parameters']['status'] == 'true' ? 1 : 0;
9 | $page->saveThis();
10 |
11 | echo "ok";
12 | exit;
13 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/edit.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_POST['csfr_token'])) {
15 | erLhcoreClassModule::redirect('fbmessenger/list');
16 | exit;
17 | }
18 |
19 | $Errors = erLhcoreClassFBValidator::validatePage($item);
20 |
21 | if (count($Errors) == 0) {
22 | try {
23 | $item->saveThis();
24 |
25 | erLhcoreClassModule::redirect('fbmessenger/list');
26 | exit;
27 |
28 | } catch (Exception $e) {
29 | $tpl->set('errors',array($e->getMessage()));
30 | }
31 |
32 | } else {
33 | $tpl->set('errors',$Errors);
34 | }
35 | }
36 |
37 | $tpl->setArray(array(
38 | 'item' => $item,
39 | ));
40 |
41 | $Result['content'] = $tpl->fetch();
42 |
43 | $Result['path'] = array(
44 | array (
45 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/list'),
46 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook pages')
47 | ),
48 | array (
49 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Edit page')
50 | )
51 | );
52 |
53 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/editnotification.php:
--------------------------------------------------------------------------------
1 | set('item',$item);
7 |
8 | if (ezcInputForm::hasPostData()) {
9 |
10 | if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
11 | erLhcoreClassModule::redirect('fbmessenger/notifications');
12 | exit;
13 | }
14 |
15 | $Errors = erLhcoreClassFBValidator::validateNotification($item);
16 |
17 | if (count($Errors) == 0) {
18 | try {
19 | $item->saveThis();
20 |
21 | if (isset($_POST['Update_page'])) {
22 | $tpl->set('updated',true);
23 | } else {
24 | erLhcoreClassModule::redirect('fbmessenger/notifications');
25 | exit ;
26 | }
27 |
28 | } catch (Exception $e) {
29 | $tpl->set('errors',array($e->getMessage()));
30 | }
31 |
32 | } else {
33 | $tpl->set('errors',$Errors);
34 | }
35 | }
36 |
37 | $Result['content'] = $tpl->fetch();
38 | $Result['path'] = array(
39 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
40 | array (
41 | 'url' =>erLhcoreClassDesign::baseurl('fbmessenger/notifications'),
42 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook notifications')
43 | ),
44 | array(
45 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Edit facebook notification')
46 | )
47 | );
48 |
49 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/fbcallback.php:
--------------------------------------------------------------------------------
1 | set('fb',$fb);
8 |
9 | try {
10 | $Result['content'] = $tpl->fetch();
11 | } catch (Exception $e) {
12 | echo $e->getMessage();
13 | exit;
14 | }
15 |
16 | $Result['path'] = array(
17 | array('url' =>erLhcoreClassDesign::baseurl('fbmessenger/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook pages'))
18 | );
19 |
20 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/fbcallbackapp.php:
--------------------------------------------------------------------------------
1 | getPage()->verify_token) {
4 | if (isset($_GET['hub_mode']) && $_GET['hub_mode'] == 'subscribe') {
5 |
6 | if ($ext->settings['enable_debug'] == true) {
7 | erLhcoreClassLog::write('VERIFIED');
8 | }
9 |
10 | echo $_GET['hub_challenge'];
11 | exit;
12 | }
13 | }
14 |
15 | erLhcoreClassLog::write('Request from app directly - '.date('Y-m-d H:i:s'));
16 |
17 | echo "all ok";
18 | exit;
19 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/fblogininstance.php:
--------------------------------------------------------------------------------
1 | settings['scopes'];
4 |
5 | $sessionCookieName = erConfigClassLhConfig::getInstance()->getSetting( 'site', 'php_session_cookie_name', false );
6 |
7 | if (!empty($sessionCookieName) && $sessionCookieName !== false) {
8 | session_name($sessionCookieName);
9 | };
10 |
11 | @session_start();
12 |
13 | $_SESSION['lhc_instance'] = $Params['user_parameters']['id'];
14 | $_SESSION['lhc_instance_uid'] = $Params['user_parameters']['uid'];
15 |
16 | $verifyHash = sha1(erConfigClassLhConfig::getInstance()->getSetting('site','seller_secret_hash') . '_' . erConfigClassLhConfig::getInstance()->getSetting('site','seller_subdomain') . '_' . $Params['user_parameters']['id'] . '_' . $Params['user_parameters']['uid'] . $Params['user_parameters']['time']);
17 | if ($verifyHash == $Params['user_parameters']['hash'])
18 | {
19 | $fb = erLhcoreClassModelFBMessengerUser::getFBAppInstance();
20 | $helper = $fb->getRedirectLoginHelper();
21 | header('Location: ' . $helper->getReRequestUrl('https://'. erConfigClassLhConfig::getInstance()->getSetting('site','seller_subdomain') . '.' . erConfigClassLhConfig::getInstance()->getSetting('site','seller_domain') . erLhcoreClassDesign::baseurl('fbmessenger/fbcallbackinstance') . '?enforce_https=1', $permissions));
22 | exit;
23 | } else {
24 | echo "Invalid hash!";
25 | exit;
26 | }
27 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/fbloginstandalone.php:
--------------------------------------------------------------------------------
1 | getRedirectLoginHelper();
6 |
7 | $permissions = erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionFbmessenger')->settings['scopes']; // Optional permissions
8 |
9 | $sessionCookieName = erConfigClassLhConfig::getInstance()->getSetting( 'site', 'php_session_cookie_name', false );
10 |
11 | if (!empty($sessionCookieName) && $sessionCookieName !== false) {
12 | session_name($sessionCookieName);
13 | }
14 |
15 | @session_start();
16 |
17 | $_SESSION['lhc_instance'] = $Params['user_parameters']['id'];
18 | $_SESSION['lhc_instance_uid'] = $Params['user_parameters']['uid'];
19 |
20 | $verifyHash = sha1(erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionFbmessenger')->settings['standalone']['secret_hash'] . '_' . erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionFbmessenger')->settings['standalone']['address'] . '_' . $Params['user_parameters']['id'] . '_' . $Params['user_parameters']['uid'] . $Params['user_parameters']['time']);
21 |
22 | if ($verifyHash == $Params['user_parameters']['hash'])
23 | {
24 | header('Location: ' . $helper->getReRequestUrl(erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionFbmessenger')->settings['standalone']['address'] . erLhcoreClassDesign::baseurl('fbmessenger/fbcallbackstandalone'), $permissions));
25 | exit;
26 | } else {
27 | echo "Invalid hash!";
28 | exit;
29 | }
30 |
31 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/fblogout.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | $user = erLhcoreClassModelFBMessengerUser::findOne(array('filter' => array('user_id' => erLhcoreClassUser::instance()->getUserID())));
9 |
10 | try {
11 | if ($user instanceof erLhcoreClassModelFBMessengerUser) {
12 |
13 | $fb = erLhcoreClassModelFBMessengerUser::getFBApp(false);
14 |
15 | if ($fb !== false){
16 | $response = $fb->get('me/accounts?type=page');
17 |
18 | $bodyResponse = $response->getDecodedBody();
19 |
20 | foreach ($bodyResponse['data'] as $page) {
21 | $pageMy = erLhcoreClassModelMyFBPage::findOne(array('filter' => array('page_id' => $page['id'])));
22 |
23 | // Remove APP from pages
24 | if ($pageMy instanceof erLhcoreClassModelMyFBPage) {
25 | $pageMy->removeThis();
26 |
27 | try {
28 | $response = $fb->delete('/' . $page['id'] . '/subscribed_apps', array(), $page['access_token']);
29 | } catch (Exception $e) {
30 |
31 | }
32 | }
33 | }
34 | } else {
35 |
36 | }
37 | }
38 |
39 | $user->removeThis();
40 | header('Location: ' .erLhcoreClassDesign::baseurldirect('site_admin/fbmessenger/index') );
41 | exit;
42 |
43 | } catch (Exception $e) {
44 |
45 | if ($user instanceof erLhcoreClassModelFBMessengerUser) {
46 | $user->removeThis();
47 | }
48 |
49 | header('Location: ' .erLhcoreClassDesign::baseurldirect('site_admin/fbmessenger/index') );
50 | exit;
51 |
52 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
53 | $tpl->set('errors', array($e->getMessage()));
54 | $Result['content'] = $tpl->fetch();
55 | $Result['path'] = array(
56 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook messenger')),
57 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook logout'))
58 | );
59 | }
60 |
61 |
62 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/index.php:
--------------------------------------------------------------------------------
1 | fetch();
5 |
6 | $Result['path'] = array(
7 | array(
8 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index'),
9 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Facebook chat')
10 | )
11 | );
12 |
13 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/leads.php:
--------------------------------------------------------------------------------
1 | 'extension/fbmessenger/classes/filter/leads.php','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
7 | $filterParams['is_search'] = true;
8 | } else {
9 | $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/fbmessenger/classes/filter/leads.php','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
10 | $filterParams['is_search'] = false;
11 | }
12 |
13 | $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
14 |
15 | $pages = new lhPaginator();
16 | $pages->items_total = erLhcoreClassModelFBLead::getCount($filterParams['filter']);
17 | $pages->translationContext = 'chat/activechats';
18 | $pages->serverURL = erLhcoreClassDesign::baseurl('fbmessenger/leads').$append;
19 | $pages->paginate();
20 | $tpl->set('pages',$pages);
21 |
22 | if ($pages->items_total > 0) {
23 | $items = erLhcoreClassModelFBLead::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low),$filterParams['filter']));
24 | $tpl->set('items',$items);
25 | }
26 |
27 | $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('fbmessenger/leads');
28 | $tpl->set('input',$filterParams['input_form']);
29 | $tpl->set('inputAppend',$append);
30 |
31 | $Result['content'] = $tpl->fetch();
32 |
33 | $Result['path'] = array(
34 | array('url' =>erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
35 | array('url' =>erLhcoreClassDesign::baseurl('fbmessenger/leads'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook leads'))
36 | );
37 |
38 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/list.php:
--------------------------------------------------------------------------------
1 | 'extension/fbmessenger/classes/filter.php','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
7 | $filterParams['is_search'] = true;
8 | } else {
9 | $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/fbmessenger/classes/filter.php','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
10 | $filterParams['is_search'] = false;
11 | }
12 |
13 | $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
14 |
15 | $pages = new lhPaginator();
16 | $pages->items_total = erLhcoreClassModelFBPage::getCount($filterParams['filter']);
17 | $pages->translationContext = 'chat/activechats';
18 | $pages->serverURL = erLhcoreClassDesign::baseurl('fbmessenger/list').$append;
19 | $pages->paginate();
20 | $tpl->set('pages',$pages);
21 |
22 | if ($pages->items_total > 0) {
23 | $items = erLhcoreClassModelFBPage::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low),$filterParams['filter']));
24 | $tpl->set('items',$items);
25 | }
26 |
27 | $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('fbmessenger/list');
28 | $tpl->set('input',$filterParams['input_form']);
29 | $tpl->set('inputAppend',$append);
30 |
31 | $Result['content'] = $tpl->fetch();
32 |
33 | $Result['path'] = array(
34 | array('url' =>erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
35 | array('url' =>erLhcoreClassDesign::baseurl('fbmessenger/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook pages'))
36 | );
37 |
38 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/myfbpages.php:
--------------------------------------------------------------------------------
1 | get('me/accounts?type=page&limit=1000');
10 |
11 | $currentPages = erLhcoreClassModelMyFBPage::getList();
12 |
13 | $pagesRemapped = array();
14 | $pagesRemappedWhatsApp = array();
15 | foreach ($currentPages as $currentPage) {
16 | $pagesRemapped[$currentPage->page_id] = $currentPage;
17 | $pagesRemappedWhatsApp[$currentPage->whatsapp_business_account_id] = $currentPage;
18 | }
19 |
20 | $tpl->set('current_pages', $pagesRemapped);
21 | $tpl->set('current_pages_whatsapp', $pagesRemappedWhatsApp);
22 | $tpl->set('pages', $response->getDecodedBody());
23 |
24 | try {
25 | $response = $fb->get('me?fields=businesses');
26 | $responseData = $response->getDecodedBody();
27 | $phoneNumbers = [];
28 |
29 | foreach ($responseData['businesses']['data'] as $dataItem) {
30 | try {
31 | $response = $fb->get($dataItem['id']. '/owned_whatsapp_business_accounts');
32 | $whatsAppBusinessAccounts = $response->getDecodedBody();
33 | foreach ($whatsAppBusinessAccounts['data'] as $whatsAppBusinessAccount) {
34 | $response = $fb->get($whatsAppBusinessAccount['id'] . '/phone_numbers');
35 | $phoneNumbersData = $response->getDecodedBody();
36 | foreach ($phoneNumbersData['data'] as $phoneNumber) {
37 | $phoneNumber['whatsapp_business_account_id'] = $whatsAppBusinessAccount['id'];
38 | $phoneNumber['whatsapp_business_account_name'] = $whatsAppBusinessAccount['name'];
39 | $phoneNumber['business_id'] = $dataItem['id'];
40 | $phoneNumber['business_name'] = $dataItem['name'];
41 | $phoneNumbers[] = $phoneNumber;
42 | }
43 | }
44 | } catch (Exception $e) {
45 |
46 | }
47 | }
48 | $tpl->set('phone_numbers', $phoneNumbers);
49 | } catch (Exception $e){ // Not all busienss we can manage
50 |
51 | }
52 |
53 | } catch (Exception $e) {
54 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
55 | $tpl->set('errors', array($e->getMessage()));
56 | }
57 |
58 |
59 | $Result['content'] = $tpl->fetch();
60 | $Result['path'] = array(
61 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook messenger')),
62 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/list'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook pages'))
63 | );
64 |
65 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/new.php:
--------------------------------------------------------------------------------
1 | set('item',$item);
7 |
8 | if (ezcInputForm::hasPostData()) {
9 |
10 | if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
11 | erLhcoreClassModule::redirect('fbmessenger/list');
12 | exit;
13 | }
14 |
15 | $Errors = erLhcoreClassFBValidator::validatePage($item);
16 |
17 | if (count($Errors) == 0) {
18 | try {
19 | $item->saveThis();
20 |
21 | erLhcoreClassModule::redirect('fbmessenger/list');
22 | exit ;
23 |
24 | } catch (Exception $e) {
25 | $tpl->set('errors',array($e->getMessage()));
26 | }
27 |
28 | } else {
29 | $tpl->set('errors',$Errors);
30 | }
31 | }
32 |
33 | $Result['content'] = $tpl->fetch();
34 | $Result['path'] = array(
35 | array (
36 | 'url' =>erLhcoreClassDesign::baseurl('fbmessenger/list'),
37 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook pages')
38 | ),
39 | array(
40 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'New facebook page')
41 | )
42 | );
43 |
44 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/newnotification.php:
--------------------------------------------------------------------------------
1 | set('item',$item);
7 |
8 | if (ezcInputForm::hasPostData()) {
9 |
10 | if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
11 | erLhcoreClassModule::redirect('fbmessenger/notifications');
12 | exit;
13 | }
14 |
15 | $Errors = erLhcoreClassFBValidator::validateNotification($item);
16 |
17 | if (count($Errors) == 0) {
18 | try {
19 | $item->saveThis();
20 |
21 | erLhcoreClassModule::redirect('fbmessenger/notifications');
22 | exit ;
23 |
24 | } catch (Exception $e) {
25 | $tpl->set('errors',array($e->getMessage()));
26 | }
27 | } else {
28 | $tpl->set('errors',$Errors);
29 | }
30 | }
31 |
32 | $Result['content'] = $tpl->fetch();
33 | $Result['path'] = array(
34 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
35 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/notifications'),'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook notifications')),
36 | array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'New facebook notification'))
37 | );
38 |
39 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/notifications.php:
--------------------------------------------------------------------------------
1 | 'extension/fbmessenger/classes/filter/notifications.php','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
7 | $filterParams['is_search'] = true;
8 | } else {
9 | $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/fbmessenger/classes/filter/notifications.php','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
10 | $filterParams['is_search'] = false;
11 | }
12 |
13 | $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
14 |
15 | $pages = new lhPaginator();
16 | $pages->items_total = erLhcoreClassModelFBNotificationSchedule::getCount($filterParams['filter']);
17 | $pages->translationContext = 'chat/activechats';
18 | $pages->serverURL = erLhcoreClassDesign::baseurl('fbmessenger/leads').$append;
19 | $pages->paginate();
20 | $tpl->set('pages',$pages);
21 |
22 | if ($pages->items_total > 0) {
23 | $items = erLhcoreClassModelFBNotificationSchedule::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low),$filterParams['filter']));
24 | $tpl->set('items',$items);
25 | }
26 |
27 | $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('fbmessenger/leads');
28 | $tpl->set('input',$filterParams['input_form']);
29 | $tpl->set('inputAppend',$append);
30 |
31 | $Result['content'] = $tpl->fetch();
32 |
33 | $Result['path'] = array(
34 | array('url' =>erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
35 | array('url' =>erLhcoreClassDesign::baseurl('fbmessenger/notifications'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook notifications'))
36 | );
37 |
38 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/registerstandalone.php:
--------------------------------------------------------------------------------
1 | settings['standalone']['secret_hash']);
10 |
11 | if ($hash == $Params['user_parameters']['hash']) {
12 | $requestBody = json_decode($bodyRequest,true);
13 |
14 | $fbUser = erLhcoreClassModelFBMessengerUser::findOne(array('filter' => array('user_id' => $requestBody['user_id'])));
15 |
16 | if (!($fbUser instanceof erLhcoreClassModelFBMessengerUser)) {
17 | $fbUser = new erLhcoreClassModelFBMessengerUser();
18 | $fbUser->user_id = $requestBody['user_id'];
19 | $fbUser->fb_user_id = $requestBody['fb_user_id'];
20 | $fbUser->access_token = $requestBody['access_token'];
21 | $fbUser->saveThis();
22 | } else {
23 | $fbUser->user_id = $requestBody['user_id'];
24 | $fbUser->fb_user_id = $requestBody['fb_user_id'];
25 | $fbUser->access_token = $requestBody['access_token'];
26 | $fbUser->saveThis();
27 | }
28 |
29 | echo json_encode(array('success' => true));
30 |
31 | } else {
32 | throw new Exception('Invalid hash verification!');
33 | }
34 |
35 | } catch (Exception $e) {
36 |
37 | http_response_code(400);
38 |
39 | echo erLhcoreClassRestAPIHandler::outputResponse(array(
40 | 'error' => true,
41 | 'result' => $e->getMessage()
42 | ));
43 | }
44 |
45 |
46 |
47 | exit;
48 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/sendtestmessage.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
6 | throw new Exception('Invalid CSRF Token');
7 | }
8 |
9 | $lead = erLhcoreClassModelFBLead::fetch($_POST['user_id']);
10 |
11 | if (!($lead instanceof erLhcoreClassModelFBLead)) {
12 | throw new Exception('Lead could not be found!');
13 | }
14 |
15 | if (is_object($lead->page)) {
16 | $messenger = Tgallice\FBMessenger\Messenger::create($lead->page->page_token);
17 |
18 | $messages = erLhcoreClassExtensionFbmessenger::parseMessageForFB(str_replace(array('{first_name}','{last_name}'), array($lead->first_name,$lead->last_name), $_POST['msg']));
19 |
20 | foreach ($messages as $msg) {
21 | if ($msg !== null) {
22 | $response = $messenger->sendMessage($lead->user_id, $msg);
23 | }
24 | }
25 |
26 | echo json_encode(array('error' => false,'msg' => 'Message was send!'));
27 |
28 | } else {
29 | throw new Exception('Page could not be found!');
30 | }
31 |
32 | } catch (Exception $e) {
33 | echo json_encode(array('error' => true, 'msg' => $e->getMessage()));
34 | }
35 |
36 | exit;
37 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/thread.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | $item = erLhcoreClassModelFBPage::fetch($Params['user_parameters']['id']);
9 |
10 | use Tgallice\FBMessenger\Messenger;
11 |
12 | if ($Params['user_parameters_unordered']['action'] == 'addbutton') {
13 | $messenger = Messenger::create($item->access_token);
14 | $messenger->setStartedButton('GET_STARTED');
15 | } else if ($Params['user_parameters_unordered']['action'] == 'rembutton') {
16 | $messenger = Messenger::create($item->access_token);
17 | $messenger->deleteStartedButton();
18 | }
19 |
20 | header('Location: ' . $_SERVER['HTTP_REFERER']);
21 | exit;
22 |
23 | exit;
24 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/threadmy.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | $fb = erLhcoreClassModelFBMessengerUser::getFBApp();
9 |
10 | use Tgallice\FBMessenger\Messenger;
11 |
12 | $item = erLhcoreClassModelMyFBPage::fetch($Params['user_parameters']['id']);
13 |
14 | if ($Params['user_parameters_unordered']['action'] == 'addbutton') {
15 | $messenger = Messenger::create($item->access_token);
16 | $messenger->setStartedButton('GET_STARTED');
17 | } else if ($Params['user_parameters_unordered']['action'] == 'rembutton') {
18 | $messenger = Messenger::create($item->access_token);
19 | $messenger->deleteStartedButton();
20 | }
21 |
22 | header('Location: ' . $_SERVER['HTTP_REFERER']);
23 | exit;
24 |
25 |
26 |
27 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/updatedepartment.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
6 | echo erLhcoreClassChat::safe_json_encode(array('error' => true, 'token' => $currentUser->getCSFRToken(), 'msg' => 'Try again or refresh a page. We could not verify your request.' ));
7 | exit;
8 | }
9 |
10 | $page = erLhcoreClassModelMyFBPage::findOne(['filter' => ['page_id' => $Params['user_parameters']['page_id']]]);
11 |
12 | if (is_object($page) && $page->enabled == 1) {
13 | $page->dep_id = $Params['user_parameters']['dep_id'];
14 | $page->updateThis(['update' => ['dep_id']]);
15 | echo erLhcoreClassChat::safe_json_encode(array('updated' => true, 'msg' => 'Department was updated!' ));
16 | }
17 |
18 | exit;
19 | ?>
--------------------------------------------------------------------------------
/modules/lhfbmessenger/updatedepartmentwhatsapp.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
6 | echo erLhcoreClassChat::safe_json_encode(array('error' => true, 'token' => $currentUser->getCSFRToken(), 'msg' => 'Try again or refresh a page. We could not verify your request.' ));
7 | exit;
8 | }
9 |
10 | $page = erLhcoreClassModelMyFBPage::findOne(['filter' => [
11 | 'page_id' => 0,
12 | 'whatsapp_business_account_id' => $Params['user_parameters']['whatsapp_business_account_id'],
13 | 'whatsapp_business_phone_number_id' => $Params['user_parameters']['phone_number_id'],
14 | ]]);
15 |
16 | if (is_object($page) && $page->enabled == 1) {
17 | $page->dep_id = $Params['user_parameters']['dep_id'];
18 | $page->updateThis(['update' => ['dep_id']]);
19 | echo erLhcoreClassChat::safe_json_encode(array('updated' => true, 'msg' => 'Department was updated!' ));
20 | }
21 |
22 | exit;
23 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/account.php:
--------------------------------------------------------------------------------
1 | 'extension/fbmessenger/classes/filter/account.php','format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
7 | $filterParams['is_search'] = true;
8 | } else {
9 | $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/fbmessenger/classes/filter/account.php','format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
10 | $filterParams['is_search'] = false;
11 | }
12 |
13 | erLhcoreClassChatStatistic::formatUserFilter($filterParams, 'lhc_fbmessengerwhatsapp_account');
14 |
15 | if (isset($filterParams['filter']['filterin']['lh_chat.dep_id'])) {
16 | $filterParams['filter']['filterin']['dep_id'] = $filterParams['filter']['filterin']['lh_chat.dep_id'];
17 | unset($filterParams['filter']['filterin']['lh_chat.dep_id']);
18 | }
19 |
20 | $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
21 |
22 | $rowsNumber = null;
23 |
24 | $filterWithoutSort = $filterParams['filter'];
25 | unset($filterWithoutSort['sort']);
26 |
27 | if (empty($filterWithoutSort) && method_exists('\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount','estimateRows')) {
28 | $rowsNumber = ($rowsNumber = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::estimateRows()) && $rowsNumber > 10000 ? $rowsNumber : null;
29 | }
30 |
31 | $pages = new lhPaginator();
32 | $pages->items_total = is_numeric($rowsNumber) ? $rowsNumber : \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::getCount($filterParams['filter']);
33 | $pages->translationContext = 'chat/activechats';
34 | $pages->serverURL = erLhcoreClassDesign::baseurl('fbwhatsapp/account').$append;
35 | $pages->paginate();
36 | $tpl->set('pages',$pages);
37 |
38 | if ($pages->items_total > 0) {
39 | $items = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low),$filterParams['filter']));
40 | $tpl->set('items',$items);
41 | }
42 |
43 | $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('fbwhatsapp/account');
44 | $tpl->set('input',$filterParams['input_form']);
45 | $tpl->set('inputAppend',$append);
46 |
47 | $Result['content'] = $tpl->fetch();
48 | $Result['path'] = array(
49 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
50 | array(
51 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Business Accounts')
52 | )
53 | );
54 |
55 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/deleteaccount.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
6 | die('Invalid CSRF Token');
7 | exit;
8 | }
9 |
10 | $item = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::fetch($Params['user_parameters']['id']);
11 | $item->removeThis();
12 |
13 | echo "ok";
14 | exit;
15 |
16 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/deletemessage.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
6 | die('Invalid CSRF Token');
7 | exit;
8 | }
9 |
10 | $item = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppMessage::fetch($Params['user_parameters']['id']);
11 |
12 | if ($item->can_delete) {
13 | $item->removeThis();
14 | }
15 |
16 | echo "ok";
17 | exit;
18 |
19 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/editaccount.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_POST['csfr_token'])) {
10 | erLhcoreClassModule::redirect('fbwhatsapp/account');
11 | exit;
12 | }
13 |
14 | if (isset($_POST['UpdatePhones_account'])) {
15 |
16 | try {
17 | $instance = LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppLiveHelperChat::getInstance();
18 | $instance->setAccessToken($item->access_token);
19 | $instance->setBusinessAccountID($item->business_account_id);
20 |
21 | $phones = $instance->getPhones();
22 | $phonesIds = [];
23 |
24 | $tpl->set('phonesUpdated', $phones);
25 |
26 | foreach ($phones as $phone) {
27 | $phonesIds[] = $phone['id'];
28 | }
29 |
30 | $item->phone_number_ids = json_encode($phonesIds);
31 | $item->updateThis();
32 | } catch (Exception $e) {
33 | $tpl->set('errors',array($e->getMessage()));
34 | }
35 |
36 | } else {
37 | $Errors = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccountValidator::validateAccount($item);
38 |
39 | if (count($Errors) == 0) {
40 | try {
41 | $item->saveThis();
42 | erLhcoreClassModule::redirect('fbwhatsapp/account');
43 | exit ;
44 |
45 | } catch (Exception $e) {
46 | $tpl->set('errors',array($e->getMessage()));
47 | }
48 | } else {
49 | $tpl->set('errors',$Errors);
50 | }
51 | }
52 | }
53 |
54 | $tpl->set('item',$item);
55 |
56 | $Result['content'] = $tpl->fetch();
57 | $Result['path'] = array(
58 | array(
59 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index'),
60 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')
61 | ),
62 | array (
63 | 'url' =>erLhcoreClassDesign::baseurl('fbwhatsapp/account'),
64 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Business Accounts')
65 | ),
66 | array(
67 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Edit Business Account')
68 | )
69 | );
70 |
71 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/limitgenerator.php:
--------------------------------------------------------------------------------
1 | fetch();
6 | $Result['path'] = array(
7 | array(
8 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index'),
9 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')
10 | ),
11 | array (
12 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Limit generator')
13 | )
14 | );
15 |
16 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/newaccount.php:
--------------------------------------------------------------------------------
1 | set('item',$item);
7 |
8 | if (ezcInputForm::hasPostData()) {
9 |
10 | if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
11 | erLhcoreClassModule::redirect('fbmessenger/bbcode');
12 | exit;
13 | }
14 |
15 | $Errors = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccountValidator::validateAccount($item);
16 |
17 | if (count($Errors) == 0) {
18 | try {
19 | $instance = LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppLiveHelperChat::getInstance();
20 | $instance->setAccessToken($item->access_token);
21 | $instance->setBusinessAccountID($item->business_account_id);
22 |
23 | $phones = $instance->getPhones();
24 | $phonesIds = [];
25 |
26 | foreach ($phones as $phone) {
27 | $phonesIds[] = $phone['id'];
28 | }
29 |
30 | $item->phone_number_ids = json_encode($phonesIds);
31 | $item->saveThis();
32 |
33 | erLhcoreClassModule::redirect('fbwhatsapp/account');
34 | exit ;
35 | } catch (Exception $e) {
36 | $tpl->set('errors',array($e->getMessage()));
37 | }
38 |
39 | } else {
40 | $tpl->set('errors',$Errors);
41 | }
42 | }
43 |
44 | $Result['content'] = $tpl->fetch();
45 | $Result['path'] = array(
46 | array(
47 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index'),
48 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')
49 | ),
50 | array (
51 | 'url' =>erLhcoreClassDesign::baseurl('fbwhatsapp/account'),
52 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Business Accounts')
53 | ),
54 | array(
55 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'New Business Account')
56 | )
57 | );
58 |
59 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/rawjson.php:
--------------------------------------------------------------------------------
1 | set('item',$item);
7 |
8 | echo $tpl->fetch();
9 | exit;
10 |
11 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/rendersend.php:
--------------------------------------------------------------------------------
1 | 0) {
10 | $account = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::fetch($Params['user_parameters']['business_account_id']);
11 | $instance->setAccessToken($account->access_token);
12 | $instance->setBusinessAccountID($account->business_account_id);
13 | }
14 |
15 | $tpl->setArray([
16 | 'data' => (isset($_POST['data']) ? json_decode($_POST['data'],true) : []),
17 | 'template' => $instance->getTemplate($params[2], $params[1]),
18 | ]);
19 |
20 | $response = explode('', $tpl->fetch());
21 |
22 | echo json_encode([
23 | 'preview' => $response[0],
24 | 'form' => $response[1],
25 | ]);
26 |
27 | exit;
28 |
29 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/rendertemplates.php:
--------------------------------------------------------------------------------
1 | 0) {
8 | $account = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::fetch($Params['user_parameters']['business_account_id']);
9 | $instance->setAccessToken($account->access_token);
10 | $instance->setBusinessAccountID($account->business_account_id);
11 | }
12 |
13 | $templates = $instance->getTemplates();
14 | $phones = $instance->getPhones();
15 |
16 | $tpl->setArray([
17 | 'templates' => $templates,
18 | 'phones' => $phones,
19 | ]);
20 |
21 | $response = explode('', $tpl->fetch());
22 |
23 | echo json_encode([
24 | 'templates' => $response[0],
25 | 'phones' => $response[1]
26 | ]);
27 |
28 | exit;
29 |
30 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsapp/templates.php:
--------------------------------------------------------------------------------
1 | getTemplates();
8 | } catch (Exception $e) {
9 | $tpl->set('error', $e->getMessage());
10 | $templates = [];
11 | }
12 |
13 | $tpl->set('templates', $templates);
14 |
15 | $Result['content'] = $tpl->fetch();
16 | $Result['path'] = array(
17 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
18 | array(
19 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Templates')
20 | )
21 | );
22 |
23 |
24 |
25 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/deletecampaign.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
4 | die('Invalid CSRF Token');
5 | exit;
6 | }
7 |
8 | try {
9 | $item = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaign::fetch($Params['user_parameters']['id']);
10 | if ($item->can_delete) {
11 | $item->removeThis();
12 | erLhcoreClassModule::redirect('fbwhatsappmessaging/campaign');
13 | exit;
14 | } else {
15 | throw new Exception('No permission to edit!');
16 | }
17 | } catch (Exception $e) {
18 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
19 | $tpl->set('errors',array($e->getMessage()));
20 | $Result['content'] = $tpl->fetch();
21 | }
22 |
23 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/deletecampaignrecipient.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | try {
9 |
10 | $item = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaignRecipient::fetch( $Params['user_parameters']['id']);
11 | if ($item->can_delete) {
12 | $item->removeThis();
13 | erLhcoreClassModule::redirect('fbwhatsappmessaging/campaignrecipient','/(campaign)/' . $item->campaign_id);
14 | exit;
15 | } else {
16 | throw new Exception('No permission to edit!');
17 | }
18 | } catch (Exception $e) {
19 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
20 | $tpl->set('errors',array($e->getMessage()));
21 | $Result['content'] = $tpl->fetch();
22 | }
23 |
24 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/deletemailinglist.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | try {
9 | $item = LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContactList::fetch( $Params['user_parameters']['id']);
10 | if ($item->can_delete) {
11 | $item->removeThis();
12 | erLhcoreClassModule::redirect('fbwhatsappmessaging/mailinglist');
13 | exit;
14 | } else {
15 | throw new Exception('No permission to edit!');
16 | }
17 | } catch (Exception $e) {
18 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
19 | $tpl->set('errors',array($e->getMessage()));
20 | $Result['content'] = $tpl->fetch();
21 | }
22 |
23 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/deleterecipient.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
4 | die('Invalid CSFR Token');
5 | exit;
6 | }
7 |
8 | try {
9 | $item = LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContact::fetch( $Params['user_parameters']['id']);
10 | if ($item->can_delete) {
11 | $item->removeThis();
12 | erLhcoreClassModule::redirect('fbwhatsappmessaging/mailingrecipient', (is_array($Params['user_parameters_unordered']['ml']) && !empty($Params['user_parameters_unordered']['ml']) ? '/(ml)/' . implode('/', $Params['user_parameters_unordered']['ml']) : ''));
13 | exit;
14 | } else {
15 | throw new Exception('No permission to edit!');
16 | }
17 | } catch (Exception $e) {
18 | $tpl = erLhcoreClassTemplate::getInstance('lhkernel/validation_error.tpl.php');
19 | $tpl->set('errors',array($e->getMessage()));
20 | $Result['content'] = $tpl->fetch();
21 | }
22 |
23 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/detailssend.php:
--------------------------------------------------------------------------------
1 | set('item', $recipient);
12 |
13 | echo $tpl->fetch();
14 | exit;
15 |
16 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/editmailinglist.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_POST['csfr_token'])) {
15 | erLhcoreClassModule::redirect('fbwhatsappmessaging/mailinglist');
16 | exit;
17 | }
18 |
19 | $Errors = LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingValidator::validateMailingList($item);
20 |
21 | if (count($Errors) == 0) {
22 | try {
23 | $item->saveThis();
24 |
25 | if (isset($_POST['Update_page'])) {
26 | $tpl->set('updated',true);
27 | } else {
28 | erLhcoreClassModule::redirect('fbwhatsappmessaging/mailinglist');
29 | exit;
30 | }
31 |
32 | } catch (Exception $e) {
33 | $tpl->set('errors',array($e->getMessage()));
34 | }
35 |
36 | } else {
37 | $tpl->set('errors',$Errors);
38 | }
39 | }
40 |
41 | $tpl->setArray(array(
42 | 'item' => $item,
43 | ));
44 |
45 | $Result['content'] = $tpl->fetch();
46 |
47 | $Result['path'] = array(
48 | array(
49 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index') ,
50 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat'),
51 | ),
52 | array(
53 | 'url' => erLhcoreClassDesign::baseurl('fbwhatsappmessaging/mailinglist'),
54 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Mailing list')
55 | ),
56 | array(
57 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Edit')
58 | )
59 | );
60 |
61 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/editmailingrecipient.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_POST['csfr_token']))) {
8 |
9 | if (!isset($_SERVER['HTTP_X_CSRFTOKEN']) || !$currentUser->validateCSFRToken($_SERVER['HTTP_X_CSRFTOKEN'])) {
10 | die('Invalid CSRF Token');
11 | exit;
12 | }
13 |
14 | $Errors = \LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingValidator::validateMailingRecipient($item);
15 |
16 | if (count($Errors) == 0) {
17 | try {
18 | $item->saveThis();
19 | $tpl->set('updated',true);
20 | } catch (Exception $e) {
21 | $tpl->set('errors',array($e->getMessage()));
22 | }
23 |
24 | } else {
25 | $tpl->set('errors',$Errors);
26 | }
27 | }
28 |
29 | $tpl->setArray(array(
30 | 'item' => $item,
31 | ));
32 |
33 | echo $tpl->fetch();
34 | exit;
35 |
36 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/mailinglist.php:
--------------------------------------------------------------------------------
1 | 'extension/fbmessenger/classes/filter/mailbox.php', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
7 | $filterParams['is_search'] = true;
8 | } else {
9 | $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/fbmessenger/classes/filter/mailbox.php', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
10 | $filterParams['is_search'] = false;
11 | }
12 |
13 | $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
14 |
15 | if (!$currentUser->hasAccessTo('lhfbwhatsappmessaging','all_contact_list')) {
16 | $filterParams['filter']['customfilter'][] = ' (private = 0 OR user_id = ' . (int)$currentUser->getUserID() . ')';
17 | }
18 |
19 | $pages = new lhPaginator();
20 | $pages->items_total = LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContactList::getCount($filterParams['filter']);
21 | $pages->translationContext = 'chat/activechats';
22 | $pages->serverURL = erLhcoreClassDesign::baseurl('fbwhatsappmessaging/mailinglist').$append;
23 | $pages->paginate();
24 | $tpl->set('pages',$pages);
25 |
26 | if ($pages->items_total > 0) {
27 | $items = LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContactList::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low),$filterParams['filter']));
28 | $tpl->set('items',$items);
29 | }
30 |
31 | $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('fbwhatsappmessaging/mailinglist');
32 | $tpl->set('input',$filterParams['input_form']);
33 | $tpl->set('inputAppend',$append);
34 |
35 | $Result['content'] = $tpl->fetch();
36 |
37 | $Result['path'] = array (
38 | array('url' => erLhcoreClassDesign::baseurl('fbmessenger/index') , 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat')),
39 | array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Recipients lists'))
40 | );
41 |
42 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/mailingrecipient.php:
--------------------------------------------------------------------------------
1 | 'extension/fbmessenger/classes/filter/mailing_recipient.php', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered']));
7 | $filterParams['is_search'] = true;
8 | } else {
9 | $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/fbmessenger/classes/filter/mailing_recipient.php', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered']));
10 | $filterParams['is_search'] = false;
11 | }
12 |
13 | // Mailing list filter
14 | if (!empty($filterParams['input_form']->ml)) {
15 | $filterParams['filter']['innerjoin']['lhc_fbmessengerwhatsapp_contact_list_contact'] = array('`lhc_fbmessengerwhatsapp_contact`.`id`','`lhc_fbmessengerwhatsapp_contact_list_contact`.`contact_id`');
16 | $filterParams['filter']['filterin']['`lhc_fbmessengerwhatsapp_contact_list_contact`.`contact_list_id`'] = $filterParams['input_form']->ml;
17 | }
18 |
19 | if (!$currentUser->hasAccessTo('lhfbwhatsappmessaging','all_contact_list')) {
20 | $filterParams['filter']['customfilter'][] = ' (private = 0 OR user_id = ' . (int)$currentUser->getUserID() . ')';
21 | }
22 |
23 | $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']);
24 |
25 | $pages = new lhPaginator();
26 | $pages->items_total = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContact::getCount($filterParams['filter']);
27 | $pages->translationContext = 'chat/activechats';
28 | $pages->serverURL = erLhcoreClassDesign::baseurl('fbwhatsappmessaging/mailingrecipient').$append;
29 | $pages->paginate();
30 | $tpl->set('pages',$pages);
31 |
32 | if ($pages->items_total > 0) {
33 | $items = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContact::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low),$filterParams['filter']));
34 | $tpl->set('items',$items);
35 | }
36 |
37 | $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('fbwhatsappmessaging/mailingrecipient');
38 | $tpl->set('input',$filterParams['input_form']);
39 | $tpl->set('inputAppend',$append);
40 |
41 | $Result['content'] = $tpl->fetch();
42 |
43 | $Result['path'] = array (
44 | array(
45 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index') ,
46 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat'),
47 | ),
48 | array(
49 | 'url' => erLhcoreClassDesign::baseurl('fbwhatsappmessaging/mailinglist'),
50 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Recipients lists')
51 | ),
52 | array('title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Recipient list'))
53 | );
54 |
55 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/newcampaign.php:
--------------------------------------------------------------------------------
1 | 0) {
15 | $item->business_account_id = $Params['user_parameters_unordered']['business_account_id'] = (int)$_POST['business_account_id'];
16 | }
17 |
18 | if ($item->business_account_id > 0) {
19 | $account = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::fetch($item->business_account_id);
20 | $instance->setAccessToken($account->access_token);
21 | $instance->setBusinessAccountID($account->business_account_id);
22 | $tpl->set('business_account_id', $account->id);
23 | }
24 |
25 | $templates = $instance->getTemplates();
26 | $phones = $instance->getPhones();
27 |
28 | if (ezcInputForm::hasPostData()) {
29 |
30 | if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
31 | erLhcoreClassModule::redirect('mailing/campaign');
32 | exit;
33 | }
34 |
35 | $items = array();
36 |
37 | $Errors = LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingValidator::validateCampaign($item);
38 |
39 | if (count($Errors) == 0) {
40 | try {
41 | $item->user_id = $currentUser->getUserID();
42 | $item->saveThis();
43 |
44 | if (isset($_POST['Save_continue'])) {
45 | erLhcoreClassModule::redirect('fbwhatsappmessaging/campaignrecipient','/(campaign)/' . $item->id);
46 | } else {
47 | erLhcoreClassModule::redirect('fbwhatsappmessaging/campaign');
48 | }
49 |
50 | exit;
51 | } catch (Exception $e) {
52 | $tpl->set('errors', array($e->getMessage()));
53 | }
54 | } else {
55 | $tpl->set('errors', $Errors);
56 | }
57 | }
58 |
59 | $tpl->setArray(array(
60 | 'item' => $item,
61 | 'templates' => $templates,
62 | 'phones' => $phones
63 | ));
64 |
65 | $Result['content'] = $tpl->fetch();
66 | $Result['additional_footer_js'] = '';
67 |
68 | $Result['path'] = array(
69 | array(
70 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index') ,
71 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat'),
72 | ),
73 | array(
74 | 'url' => erLhcoreClassDesign::baseurl('fbwhatsappmessaging/campaign'),
75 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Campaigns')
76 | ),
77 | array(
78 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'New')
79 | )
80 | );
81 |
82 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/newcampaignrecipient.php:
--------------------------------------------------------------------------------
1 | 0) {
12 | $item = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaignRecipient::fetch($Params['user_parameters']['recipient_id']);
13 | } else {
14 | $item = new \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaignRecipient();
15 | $item->campaign_id = $campaign->id;
16 | $item->type = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaignRecipient::TYPE_MANUAL;
17 | }
18 |
19 | if (ezcInputForm::hasPostData() && !(!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token']))) {
20 |
21 | $items = array();
22 | $Errors = \LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingValidator::validateCampaignRecipient($item);
23 | if (count($Errors) == 0) {
24 | try {
25 | $item->saveThis();
26 | $tpl->set('updated', true);
27 | } catch (Exception $e) {
28 | $tpl->set('errors', array($e->getMessage()));
29 | }
30 | } else {
31 | $tpl->set('errors', $Errors);
32 | }
33 | }
34 |
35 | $tpl->set('item', $item);
36 | $tpl->set('campaign', $campaign);
37 | echo $tpl->fetch();
38 | exit;
39 |
40 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/newmailinglist.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($_POST['csfr_token'])) {
15 | erLhcoreClassModule::redirect('fbwhatsappmessaging/mailinglist');
16 | exit;
17 | }
18 |
19 | $items = array();
20 |
21 | $Errors = LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingValidator::validateMailingList($item);
22 |
23 | if (count($Errors) == 0) {
24 | try {
25 | $item->user_id = $currentUser->getUserID();
26 | $item->saveThis();
27 | erLhcoreClassModule::redirect('fbwhatsappmessaging/mailinglist');
28 | exit;
29 | } catch (Exception $e) {
30 | $tpl->set('errors', array($e->getMessage()));
31 | }
32 |
33 | } else {
34 | $tpl->set('errors', $Errors);
35 | }
36 | }
37 |
38 | $tpl->set('item', $item);
39 |
40 | $Result['content'] = $tpl->fetch();
41 |
42 | $Result['path'] = array(
43 | array(
44 | 'url' => erLhcoreClassDesign::baseurl('fbmessenger/index') ,
45 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger','Facebook chat'),
46 | ),
47 | array(
48 | 'url' => erLhcoreClassDesign::baseurl('fbwhatsappmessaging/mailinglist'),
49 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'Recipients lists')
50 | ),
51 | array(
52 | 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('module/fbmessenger', 'New')
53 | )
54 | );
55 |
56 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/newmailingrecipient.php:
--------------------------------------------------------------------------------
1 | ml_ids_front = $Params['user_parameters_unordered']['ml'];
9 | }
10 |
11 | if (ezcInputForm::hasPostData() && !(!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token']))) {
12 |
13 | $items = array();
14 | $Errors = \LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingValidator::validateMailingRecipient($item);
15 |
16 | if (count($Errors) == 0) {
17 | try {
18 | $item->user_id = $currentUser->getUserID();
19 |
20 | $item->saveThis();
21 |
22 | if ($item->isAllPrivateListMember() === true) {
23 | $item->private = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContact::LIST_PRIVATE;
24 | $item->saveThis(['update' => ['private']]);
25 | }
26 |
27 | $tpl->set('updated', true);
28 | } catch (Exception $e) {
29 | $tpl->set('errors', array($e->getMessage()));
30 | }
31 |
32 | } else {
33 | $tpl->set('errors', $Errors);
34 | }
35 | }
36 |
37 | $tpl->set('item', $item);
38 |
39 | $Result['content'] = $tpl->fetch();
40 |
41 | echo $tpl->fetch();
42 | exit;
43 |
44 | ?>
--------------------------------------------------------------------------------
/modules/lhfbwhatsappmessaging/sendtestmessage.php:
--------------------------------------------------------------------------------
1 | validateCSFRToken($Params['user_parameters_unordered']['csfr'])) {
6 | die('Invalid CSFR Token');
7 | exit;
8 | }
9 |
10 | $recipient = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaignRecipient::fetch($Params['user_parameters']['id']);
11 |
12 | if (!($recipient instanceof \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaignRecipient)) {
13 | die('Invalid recipient!');
14 | }
15 |
16 | $campaign = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaign::fetch($recipient->campaign_id);
17 |
18 | $instance = LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppLiveHelperChat::getInstance();
19 |
20 | if ($campaign->business_account_id > 0) {
21 | $account = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount::fetch($campaign->business_account_id);
22 | $instance->setAccessToken($account->access_token);
23 | $instance->setBusinessAccountID($account->business_account_id);
24 | }
25 |
26 | $templates = $instance->getTemplates();
27 | $phones = $instance->getPhones();
28 |
29 | \LiveHelperChatExtension\fbmessenger\providers\FBMessengerWhatsAppMailingWorker::sendMessage($recipient, $campaign, $instance, $templates, $phones);
30 |
31 | header('Location: ' . $_SERVER['HTTP_REFERER']);
32 | exit;
33 |
34 | ?>
--------------------------------------------------------------------------------
/pos/erlhcoreclassmodelfbmessengeruser.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessenger_fbuser";
5 | $def->class = "erLhcoreClassModelFBMessengerUser";
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | $def->properties['user_id'] = new ezcPersistentObjectProperty();
13 | $def->properties['user_id']->columnName = 'user_id';
14 | $def->properties['user_id']->propertyName = 'user_id';
15 | $def->properties['user_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
16 |
17 | $def->properties['fb_user_id'] = new ezcPersistentObjectProperty();
18 | $def->properties['fb_user_id']->columnName = 'fb_user_id';
19 | $def->properties['fb_user_id']->propertyName = 'fb_user_id';
20 | $def->properties['fb_user_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
21 |
22 | $def->properties['access_token'] = new ezcPersistentObjectProperty();
23 | $def->properties['access_token']->columnName = 'access_token';
24 | $def->properties['access_token']->propertyName = 'access_token';
25 | $def->properties['access_token']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
26 |
27 | return $def;
28 |
29 | ?>
--------------------------------------------------------------------------------
/pos/erlhcoreclassmodelfbnotificationschedule.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessenger_notification_schedule";
5 | $def->class = "erLhcoreClassModelFBNotificationSchedule";
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | $def->properties['filter'] = new ezcPersistentObjectProperty();
13 | $def->properties['filter']->columnName = 'filter';
14 | $def->properties['filter']->propertyName = 'filter';
15 | $def->properties['filter']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
16 |
17 | $def->properties['message'] = new ezcPersistentObjectProperty();
18 | $def->properties['message']->columnName = 'message';
19 | $def->properties['message']->propertyName = 'message';
20 | $def->properties['message']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
21 |
22 | $def->properties['name'] = new ezcPersistentObjectProperty();
23 | $def->properties['name']->columnName = 'name';
24 | $def->properties['name']->propertyName = 'name';
25 | $def->properties['name']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
26 |
27 | $def->properties['start_at'] = new ezcPersistentObjectProperty();
28 | $def->properties['start_at']->columnName = 'start_at';
29 | $def->properties['start_at']->propertyName = 'start_at';
30 | $def->properties['start_at']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
31 |
32 | $def->properties['status'] = new ezcPersistentObjectProperty();
33 | $def->properties['status']->columnName = 'status';
34 | $def->properties['status']->propertyName = 'status';
35 | $def->properties['status']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
36 |
37 | $def->properties['last_send'] = new ezcPersistentObjectProperty();
38 | $def->properties['last_send']->columnName = 'last_send';
39 | $def->properties['last_send']->propertyName = 'last_send';
40 | $def->properties['last_send']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
41 |
42 | $def->properties['interval'] = new ezcPersistentObjectProperty();
43 | $def->properties['interval']->columnName = 'interval';
44 | $def->properties['interval']->propertyName = 'interval';
45 | $def->properties['interval']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
46 |
47 | $def->properties['amount'] = new ezcPersistentObjectProperty();
48 | $def->properties['amount']->columnName = 'amount';
49 | $def->properties['amount']->propertyName = 'amount';
50 | $def->properties['amount']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
51 |
52 | return $def;
53 |
54 | ?>
--------------------------------------------------------------------------------
/pos/erlhcoreclassmodelfbnotificationschedulecampaign.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessenger_notification_schedule_campaign";
5 | $def->class = "erLhcoreClassModelFBNotificationScheduleCampaign";
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | $def->properties['schedule_id'] = new ezcPersistentObjectProperty();
13 | $def->properties['schedule_id']->columnName = 'schedule_id';
14 | $def->properties['schedule_id']->propertyName = 'schedule_id';
15 | $def->properties['schedule_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
16 |
17 | $def->properties['status'] = new ezcPersistentObjectProperty();
18 | $def->properties['status']->columnName = 'status';
19 | $def->properties['status']->propertyName = 'status';
20 | $def->properties['status']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
21 |
22 | $def->properties['last_id'] = new ezcPersistentObjectProperty();
23 | $def->properties['last_id']->columnName = 'last_id';
24 | $def->properties['last_id']->propertyName = 'last_id';
25 | $def->properties['last_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
26 |
27 | $def->properties['ctime'] = new ezcPersistentObjectProperty();
28 | $def->properties['ctime']->columnName = 'ctime';
29 | $def->properties['ctime']->propertyName = 'ctime';
30 | $def->properties['ctime']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
31 |
32 | $def->properties['last_send'] = new ezcPersistentObjectProperty();
33 | $def->properties['last_send']->columnName = 'last_send';
34 | $def->properties['last_send']->propertyName = 'last_send';
35 | $def->properties['last_send']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
36 |
37 | return $def;
38 |
39 | ?>
--------------------------------------------------------------------------------
/pos/erlhcoreclassmodelfbnotificationscheduleitem.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessenger_notification_schedule_item";
5 | $def->class = "erLhcoreClassModelFBNotificationScheduleItem";
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | $def->properties['schedule_id'] = new ezcPersistentObjectProperty();
13 | $def->properties['schedule_id']->columnName = 'schedule_id';
14 | $def->properties['schedule_id']->propertyName = 'schedule_id';
15 | $def->properties['schedule_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
16 |
17 | $def->properties['status'] = new ezcPersistentObjectProperty();
18 | $def->properties['status']->columnName = 'status';
19 | $def->properties['status']->propertyName = 'status';
20 | $def->properties['status']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
21 |
22 | $def->properties['lead_id'] = new ezcPersistentObjectProperty();
23 | $def->properties['lead_id']->columnName = 'lead_id';
24 | $def->properties['lead_id']->propertyName = 'lead_id';
25 | $def->properties['lead_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
26 |
27 | $def->properties['campaign_id'] = new ezcPersistentObjectProperty();
28 | $def->properties['campaign_id']->columnName = 'campaign_id';
29 | $def->properties['campaign_id']->propertyName = 'campaign_id';
30 | $def->properties['campaign_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
31 |
32 | $def->properties['send_time'] = new ezcPersistentObjectProperty();
33 | $def->properties['send_time']->columnName = 'send_time';
34 | $def->properties['send_time']->propertyName = 'send_time';
35 | $def->properties['send_time']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
36 |
37 | $def->properties['log'] = new ezcPersistentObjectProperty();
38 | $def->properties['log']->columnName = 'log';
39 | $def->properties['log']->propertyName = 'log';
40 | $def->properties['log']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
41 |
42 | return $def;
43 |
44 | ?>
--------------------------------------------------------------------------------
/pos/erlhcoreclassmodelfbpage.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessenger_page";
5 | $def->class = "erLhcoreClassModelFBPage";
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | $def->properties['dep_id'] = new ezcPersistentObjectProperty();
13 | $def->properties['dep_id']->columnName = 'dep_id';
14 | $def->properties['dep_id']->propertyName = 'dep_id';
15 | $def->properties['dep_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
16 |
17 | $def->properties['page_id'] = new ezcPersistentObjectProperty();
18 | $def->properties['page_id']->columnName = 'page_id';
19 | $def->properties['page_id']->propertyName = 'page_id';
20 | $def->properties['page_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
21 |
22 | $def->properties['page_token'] = new ezcPersistentObjectProperty();
23 | $def->properties['page_token']->columnName = 'page_token';
24 | $def->properties['page_token']->propertyName = 'page_token';
25 | $def->properties['page_token']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
26 |
27 | $def->properties['verify_token'] = new ezcPersistentObjectProperty();
28 | $def->properties['verify_token']->columnName = 'verify_token';
29 | $def->properties['verify_token']->propertyName = 'verify_token';
30 | $def->properties['verify_token']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
31 |
32 | $def->properties['app_secret'] = new ezcPersistentObjectProperty();
33 | $def->properties['app_secret']->columnName = 'app_secret';
34 | $def->properties['app_secret']->propertyName = 'app_secret';
35 | $def->properties['app_secret']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
36 |
37 | $def->properties['name'] = new ezcPersistentObjectProperty();
38 | $def->properties['name']->columnName = 'name';
39 | $def->properties['name']->propertyName = 'name';
40 | $def->properties['name']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
41 |
42 | $def->properties['verified'] = new ezcPersistentObjectProperty();
43 | $def->properties['verified']->columnName = 'verified';
44 | $def->properties['verified']->propertyName = 'verified';
45 | $def->properties['verified']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
46 |
47 | $def->properties['bot_disabled'] = new ezcPersistentObjectProperty();
48 | $def->properties['bot_disabled']->columnName = 'bot_disabled';
49 | $def->properties['bot_disabled']->propertyName = 'bot_disabled';
50 | $def->properties['bot_disabled']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
51 |
52 | return $def;
53 |
54 | ?>
--------------------------------------------------------------------------------
/pos/erlhcoreclassmodelmyfbpage.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessenger_my_page";
5 | $def->class = "erLhcoreClassModelMyFBPage";
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | $def->properties['page_id'] = new ezcPersistentObjectProperty();
13 | $def->properties['page_id']->columnName = 'page_id';
14 | $def->properties['page_id']->propertyName = 'page_id';
15 | $def->properties['page_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
16 |
17 | $def->properties['instagram_business_account'] = new ezcPersistentObjectProperty();
18 | $def->properties['instagram_business_account']->columnName = 'instagram_business_account';
19 | $def->properties['instagram_business_account']->propertyName = 'instagram_business_account';
20 | $def->properties['instagram_business_account']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
21 |
22 | $def->properties['whatsapp_business_account_id'] = new ezcPersistentObjectProperty();
23 | $def->properties['whatsapp_business_account_id']->columnName = 'whatsapp_business_account_id';
24 | $def->properties['whatsapp_business_account_id']->propertyName = 'whatsapp_business_account_id';
25 | $def->properties['whatsapp_business_account_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
26 |
27 | $def->properties['whatsapp_business_phone_number_id'] = new ezcPersistentObjectProperty();
28 | $def->properties['whatsapp_business_phone_number_id']->columnName = 'whatsapp_business_phone_number_id';
29 | $def->properties['whatsapp_business_phone_number_id']->propertyName = 'whatsapp_business_phone_number_id';
30 | $def->properties['whatsapp_business_phone_number_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
31 |
32 | $def->properties['access_token'] = new ezcPersistentObjectProperty();
33 | $def->properties['access_token']->columnName = 'access_token';
34 | $def->properties['access_token']->propertyName = 'access_token';
35 | $def->properties['access_token']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
36 |
37 | $def->properties['enabled'] = new ezcPersistentObjectProperty();
38 | $def->properties['enabled']->columnName = 'enabled';
39 | $def->properties['enabled']->propertyName = 'enabled';
40 | $def->properties['enabled']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
41 |
42 | $def->properties['dep_id'] = new ezcPersistentObjectProperty();
43 | $def->properties['dep_id']->columnName = 'dep_id';
44 | $def->properties['dep_id']->propertyName = 'dep_id';
45 | $def->properties['dep_id']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
46 |
47 | $def->properties['bot_disabled'] = new ezcPersistentObjectProperty();
48 | $def->properties['bot_disabled']->columnName = 'bot_disabled';
49 | $def->properties['bot_disabled']->propertyName = 'bot_disabled';
50 | $def->properties['bot_disabled']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
51 |
52 | return $def;
53 |
54 | ?>
--------------------------------------------------------------------------------
/pos/livehelperchatextension/fbmessenger/providers/erlhcoreclassmodelmessagefbwhatsappaccount.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessengerwhatsapp_account";
5 | $def->class = '\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppAccount';
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | foreach (['dep_id', 'business_account_id', 'active'] as $posAttr) {
13 | $def->properties[$posAttr] = new ezcPersistentObjectProperty();
14 | $def->properties[$posAttr]->columnName = $posAttr;
15 | $def->properties[$posAttr]->propertyName = $posAttr;
16 | $def->properties[$posAttr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
17 | }
18 |
19 | foreach (['access_token', 'name', 'phone_number_ids', 'phone_number_deps'] as $posAttr) {
20 | $def->properties[$posAttr] = new ezcPersistentObjectProperty();
21 | $def->properties[$posAttr]->columnName = $posAttr;
22 | $def->properties[$posAttr]->propertyName = $posAttr;
23 | $def->properties[$posAttr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
24 | }
25 |
26 | return $def;
27 |
28 | ?>
--------------------------------------------------------------------------------
/pos/livehelperchatextension/fbmessenger/providers/erlhcoreclassmodelmessagefbwhatsappcampaign.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessengerwhatsapp_campaign";
5 | $def->class = '\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaign';
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | foreach (array('name','message_variables','phone_sender','phone_sender_id','template','template_id','language') as $attr) {
13 | $def->properties[$attr] = new ezcPersistentObjectProperty();
14 | $def->properties[$attr]->columnName = $attr;
15 | $def->properties[$attr]->propertyName = $attr;
16 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
17 | }
18 |
19 | foreach (array(
20 | 'status','starts_at','user_id','enabled',
21 | 'business_account_id','dep_id','private'
22 | ) as $attr) {
23 | $def->properties[$attr] = new ezcPersistentObjectProperty();
24 | $def->properties[$attr]->columnName = $attr;
25 | $def->properties[$attr]->propertyName = $attr;
26 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
27 | }
28 |
29 | return $def;
30 |
31 | ?>
32 | ?>
--------------------------------------------------------------------------------
/pos/livehelperchatextension/fbmessenger/providers/erlhcoreclassmodelmessagefbwhatsappcampaignrecipient.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessengerwhatsapp_campaign_recipient";
5 | $def->class = '\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppCampaignRecipient';
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | foreach (array(
13 | 'email','name','phone','phone_recipient',
14 | 'attr_str_1','attr_str_2','attr_str_3',
15 | 'attr_str_4','attr_str_5','attr_str_6',
16 | 'log','title','lastname','company','file_1','file_2','file_3','file_4'
17 | ) as $attr) {
18 | $def->properties[$attr] = new ezcPersistentObjectProperty();
19 | $def->properties[$attr]->columnName = $attr;
20 | $def->properties[$attr]->propertyName = $attr;
21 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
22 | }
23 |
24 | foreach (array(
25 | 'campaign_id','recipient_id','status','send_at','type',
26 | 'message_id','conversation_id','opened_at','created_at',
27 | 'date','delivery_status'
28 | ) as $attr) {
29 | $def->properties[$attr] = new ezcPersistentObjectProperty();
30 | $def->properties[$attr]->columnName = $attr;
31 | $def->properties[$attr]->propertyName = $attr;
32 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
33 | }
34 |
35 | return $def;
36 |
37 | ?>
--------------------------------------------------------------------------------
/pos/livehelperchatextension/fbmessenger/providers/erlhcoreclassmodelmessagefbwhatsappcontact.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessengerwhatsapp_contact";
5 | $def->class = '\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContact';
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | foreach (array(
13 | 'email','data','name','phone','phone_recipient',
14 | 'attr_str_1','attr_str_2','attr_str_3',
15 | 'attr_str_4','attr_str_5','attr_str_6',
16 | 'title','lastname','company','file_1','file_2','file_3','file_4'
17 | ) as $attr) {
18 | $def->properties[$attr] = new ezcPersistentObjectProperty();
19 | $def->properties[$attr]->columnName = $attr;
20 | $def->properties[$attr]->propertyName = $attr;
21 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
22 | }
23 |
24 | foreach (array(
25 | 'disabled',
26 | 'created_at',
27 | 'date','delivery_status',
28 | 'chat_id','user_id','private'
29 | ) as $attr) {
30 | $def->properties[$attr] = new ezcPersistentObjectProperty();
31 | $def->properties[$attr]->columnName = $attr;
32 | $def->properties[$attr]->propertyName = $attr;
33 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
34 | }
35 |
36 | return $def;
37 |
38 |
39 | ?>
--------------------------------------------------------------------------------
/pos/livehelperchatextension/fbmessenger/providers/erlhcoreclassmodelmessagefbwhatsappcontactlist.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessengerwhatsapp_contact_list";
5 | $def->class = '\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContactList';
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | foreach (array(
13 | 'name'
14 | ) as $attr) {
15 | $def->properties[$attr] = new ezcPersistentObjectProperty();
16 | $def->properties[$attr]->columnName = $attr;
17 | $def->properties[$attr]->propertyName = $attr;
18 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
19 | }
20 |
21 | foreach (array(
22 | 'user_id',
23 | 'private',
24 | 'created_at',
25 | ) as $attr) {
26 | $def->properties[$attr] = new ezcPersistentObjectProperty();
27 | $def->properties[$attr]->columnName = $attr;
28 | $def->properties[$attr]->propertyName = $attr;
29 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
30 | }
31 |
32 | return $def;
33 |
34 | ?>
--------------------------------------------------------------------------------
/pos/livehelperchatextension/fbmessenger/providers/erlhcoreclassmodelmessagefbwhatsappcontactlistcontact.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessengerwhatsapp_contact_list_contact";
5 | $def->class = '\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContactListContact';
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | foreach (array(
13 | 'contact_list_id','contact_id'
14 | ) as $attr) {
15 | $def->properties[$attr] = new ezcPersistentObjectProperty();
16 | $def->properties[$attr]->columnName = $attr;
17 | $def->properties[$attr]->propertyName = $attr;
18 | $def->properties[$attr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
19 | }
20 |
21 | return $def;
22 |
23 | ?>
--------------------------------------------------------------------------------
/pos/livehelperchatextension/fbmessenger/providers/erlhcoreclassmodelmessagefbwhatsappmessage.php:
--------------------------------------------------------------------------------
1 | table = "lhc_fbmessengerwhatsapp_message";
5 | $def->class = '\LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppMessage';
6 |
7 | $def->idProperty = new ezcPersistentObjectIdProperty();
8 | $def->idProperty->columnName = 'id';
9 | $def->idProperty->propertyName = 'id';
10 | $def->idProperty->generator = new ezcPersistentGeneratorDefinition( 'ezcPersistentNativeGenerator' );
11 |
12 | foreach (['created_at', 'updated_at', 'status', 'user_id', 'chat_id', 'dep_id', 'initiation', 'business_account_id', 'scheduled_at',
13 | 'campaign_id', 'campaign_recipient_id','recipient_id','private'] as $posAttr) {
14 | $def->properties[$posAttr] = new ezcPersistentObjectProperty();
15 | $def->properties[$posAttr]->columnName = $posAttr;
16 | $def->properties[$posAttr]->propertyName = $posAttr;
17 | $def->properties[$posAttr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT;
18 | }
19 |
20 | foreach (['phone', 'phone_whatsapp', 'phone_sender', 'phone_sender_id', 'template','template_id', 'message', 'language', 'fb_msg_id', 'send_status_raw', 'conversation_id', 'message_variables'] as $posAttr) {
21 | $def->properties[$posAttr] = new ezcPersistentObjectProperty();
22 | $def->properties[$posAttr]->columnName = $posAttr;
23 | $def->properties[$posAttr]->propertyName = $posAttr;
24 | $def->properties[$posAttr]->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING;
25 | }
26 |
27 | return $def;
28 |
29 | ?>
--------------------------------------------------------------------------------
/providers/erLhcoreClassModelMessageFBWhatsAppAccount.php:
--------------------------------------------------------------------------------
1 | $this->id,
21 | 'dep_id' => $this->dep_id,
22 | 'name' => $this->name,
23 | 'access_token' => $this->access_token,
24 | 'business_account_id' => $this->business_account_id,
25 | 'active' => $this->active,
26 | 'phone_number_ids' => $this->phone_number_ids,
27 | 'phone_number_deps' => $this->phone_number_deps
28 | );
29 | }
30 |
31 | public function __toString()
32 | {
33 | return $this->name;
34 | }
35 |
36 | public function __get($var)
37 | {
38 | switch ($var) {
39 |
40 | case 'department':
41 | $this->department = null;
42 | if ($this->dep_id > 0) {
43 | try {
44 | $this->department = \erLhcoreClassModelDepartament::fetch($this->dep_id,true);
45 | } catch (\Exception $e) {
46 |
47 | }
48 | }
49 | return $this->department;
50 |
51 | case 'phone_number_ids_array':
52 | case 'phone_number_deps_array':
53 | $attr = str_replace('_array','',$var);
54 | if (!empty($this->{$attr})) {
55 | $jsonData = json_decode($this->{$attr},true);
56 | if ($jsonData !== null) {
57 | $this->{$var} = $jsonData;
58 | } else {
59 | $this->{$var} = array();
60 | }
61 | } else {
62 | $this->{$var} = array();
63 | }
64 | return $this->{$var};
65 |
66 | default:
67 | ;
68 | break;
69 | }
70 | }
71 |
72 | public $id = null;
73 | public $dep_id = 0;
74 | public $active = 1;
75 | public $name = '';
76 | public $access_token = '';
77 | public $business_account_id = '';
78 | public $phone_number_ids = '';
79 | public $phone_number_deps = '';
80 | }
81 |
82 | ?>
--------------------------------------------------------------------------------
/providers/erLhcoreClassModelMessageFBWhatsAppContactListContact.php:
--------------------------------------------------------------------------------
1 | $this->id,
21 | 'contact_list_id' => $this->contact_list_id,
22 | 'contact_id' => $this->contact_id
23 | );
24 | }
25 |
26 | public function __toString()
27 | {
28 | return $this->email;
29 | }
30 |
31 | public function __get($var)
32 | {
33 | switch ($var) {
34 | case 'mtime_front':
35 | return date('Ymd') == date('Ymd', $this->mtime) ? date(\erLhcoreClassModule::$dateHourFormat, $this->mtime) : date(\erLhcoreClassModule::$dateDateHourFormat, $this->mtime);
36 |
37 | case 'mailing_recipient':
38 | $this->mailing_recipient = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContact::fetch($this->contact_id);
39 | return $this->mailing_recipient;
40 |
41 | case 'contact_list':
42 | $this->contact_list = \LiveHelperChatExtension\fbmessenger\providers\erLhcoreClassModelMessageFBWhatsAppContactList::fetch($this->contact_list_id);
43 | return $this->contact_list;
44 |
45 | default:
46 | break;
47 | }
48 | }
49 |
50 | public $id = NULL;
51 | public $contact_list_id = null;
52 | public $contact_id = null;
53 | }
54 |
55 | ?>
--------------------------------------------------------------------------------
/settings/settings.ini.default.php:
--------------------------------------------------------------------------------
1 | false, // Log errors etc in cache/default.log file
5 | 'fb_disabled' => false, // If you only WhatsApp integration you can disable facebook messenger related part completely
6 | 'hide_fb_login' => false, // Hide fb login option and leave only manual page definition
7 | 'scopes' => array(
8 | 'email',
9 | 'pages_show_list',
10 | 'pages_messaging',
11 | 'instagram_manage_messages',
12 | 'instagram_basic',
13 | 'pages_manage_metadata',
14 |
15 | // New after update
16 | 'pages_read_engagement',
17 |
18 | // WhatsApp
19 | 'whatsapp_business_management',
20 | 'whatsapp_business_messaging',
21 | 'business_management'
22 | ),
23 | 'standalone' => array (
24 | 'disable_manual_whatsapp' => false, # Should we hide WhatsApp manual numbers section?
25 | 'enabled' => false, # Is standalone mode enabled. Are we in automated hosting environment?
26 | 'secret_hash' => '', # Put any random string we use for communication and verifying request
27 | 'address' => 'https://master.example.com' # Master instance where all logins happen
28 | ),
29 | 'app_settings' => array (
30 | 'app_id' => getenv('FBM_APPID') ?: '', # Facebook Messenger App ID
31 | 'app_secret' => getenv('FBM_APPSECRET') ?: '', # Facebook Messenger App Secret
32 | 'verify_token' => getenv('FBM_VERIFYTOKEN') ?: '', # Facebook Messenger Verify Token
33 | 'whatsapp_verify_token' => getenv('WHATSAPP_VERIFYTOKEN') ?: '', # WhatsApp Verify Token
34 | 'instagram_verify_token' => getenv('INSTAGRAM_VERIFYTOKEN') ?: '', # Instagram verify Token
35 | )
36 | );
37 |
38 | ?>
39 |
--------------------------------------------------------------------------------
/translations/lt_LT/translation.ts:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | module/fbmessenger
6 |
7 | Facebook chat
8 | Facebook pokalbiai
9 |
10 |
11 |
--------------------------------------------------------------------------------