WP-Chatbot for Facebook Messenger Customer Chat - Version 2.0

Version Description

  • can add ref
  • set chat window minimized or not
Download this release

Release Info

Developer bhvreddy
Plugin Icon 128x128 WP-Chatbot for Facebook Messenger Customer Chat
Version 2.0
Comparing to
See all releases

Code changes from version 1.3.0 to 2.0

admin/class-htcc-admin.php CHANGED
@@ -83,6 +83,8 @@ class HTCC_Admin {
83
add_settings_field( 'htcc_shortcode', __( 'Shortcode name' , 'wp-chatbot' ), array( $this, 'htcc_custom_shortcode_cb' ), 'htcc_options_settings', 'htcc_settings' );
84
85
add_settings_field( 'htcc_fb_sdk_lang', __( 'Messenger language' , 'wp-chatbot' ), array( $this, 'htcc_fb_sdk_lang_cb' ), 'htcc_options_settings', 'htcc_settings' );
86
87
}
88
@@ -91,12 +93,13 @@ class HTCC_Admin {
91
echo '<h1>WP-Chatbot Settings</h1>';
92
}
93
94
public function htcc_enable_cb() {
95
$enable = get_option('htcc_options');
96
?>
97
<div>
98
<select name="htcc_options[enable]" class="select-1">
99
- <option value="no">No</option>
100
<option value="1" <?php echo esc_attr( $enable['enable'] ) == '1' ? 'SELECTED' : ''; ?> ><?php _e( 'Yes' , 'wp-chatbot' ) ?></option>
101
</select>
102
</div>
@@ -128,7 +131,7 @@ class HTCC_Admin {
128
}
129
130
131
- // sdk lang.
132
public function htcc_fb_sdk_lang_cb() {
133
134
$sdk_lang = get_option('htcc_options');
@@ -148,10 +151,36 @@ class HTCC_Admin {
148
?>
149
</select>
150
</div>
151
- <p class="description"><?php _e( 'If desired Language is not added, please message us - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/messenger-language/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
152
<?php
153
}
154
155
156
// checkboxes - based on Type of posts ..
157
public function htcc_show_hide_post_types_cb() {
@@ -405,6 +434,12 @@ class HTCC_Admin {
405
if( isset( $input['fb_sdk_lang'] ) )
406
$new_input['fb_sdk_lang'] = sanitize_text_field( $input['fb_sdk_lang'] );
407
408
if( isset( $input['hideon_posts'] ) )
409
$new_input['hideon_posts'] = sanitize_text_field( $input['hideon_posts'] );
410
83
add_settings_field( 'htcc_shortcode', __( 'Shortcode name' , 'wp-chatbot' ), array( $this, 'htcc_custom_shortcode_cb' ), 'htcc_options_settings', 'htcc_settings' );
84
85
add_settings_field( 'htcc_fb_sdk_lang', __( 'Messenger language' , 'wp-chatbot' ), array( $this, 'htcc_fb_sdk_lang_cb' ), 'htcc_options_settings', 'htcc_settings' );
86
+ add_settings_field( 'htcc_fb_is_minimized', __( 'Minimized' , 'wp-chatbot' ), array( $this, 'htcc_fb_is_minimized_cb' ), 'htcc_options_settings', 'htcc_settings' );
87
+ add_settings_field( 'htcc_fb_ref', __( 'Ref' , 'wp-chatbot' ), array( $this, 'htcc_fb_ref_cb' ), 'htcc_options_settings', 'htcc_settings' );
88
89
}
90
93
echo '<h1>WP-Chatbot Settings</h1>';
94
}
95
96
+ // enable
97
public function htcc_enable_cb() {
98
$enable = get_option('htcc_options');
99
?>
100
<div>
101
<select name="htcc_options[enable]" class="select-1">
102
+ <option value="no"><?php _e( 'No' , 'wp-chatbot' ) ?></option>
103
<option value="1" <?php echo esc_attr( $enable['enable'] ) == '1' ? 'SELECTED' : ''; ?> ><?php _e( 'Yes' , 'wp-chatbot' ) ?></option>
104
</select>
105
</div>
131
}
132
133
134
+ // sdk lang. / messenger lang
135
public function htcc_fb_sdk_lang_cb() {
136
137
$sdk_lang = get_option('htcc_options');
151
?>
152
</select>
153
</div>
154
+ <p class="description"><?php _e( 'Language what display in chat window, not user input - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/messenger-language/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
155
+ <p class="description"><?php _e( 'If desired Language is not added - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://www.messenger.com/t/1541811499235090/"><?php _e( 'please message us' , 'wp-chatbot' ) ?></a> </p>
156
<?php
157
}
158
159
+ // minimized
160
+ public function htcc_fb_is_minimized_cb() {
161
+ $minimized = get_option('htcc_options');
162
+ ?>
163
+ <div>
164
+ <select name="htcc_options[minimized]" class="select-1">
165
+ <option value="false"><?php _e( 'False' , 'wp-chatbot' ) ?></option>
166
+ <option value="true" <?php echo esc_attr( $minimized['minimized'] ) == 'true' ? 'SELECTED' : ''; ?> ><?php _e( 'True' , 'wp-chatbot' ) ?></option>
167
+ </select>
168
+ </div>
169
+ <p class="description"><?php _e( 'If true - chat window is minimized' , 'wp-chatbot' ) ?> </p>
170
+ <p class="description"><?php _e( '( Initial time only, user can minimize or not for later visits, facebook sdk handle this ) - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/minimize-messenger/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
171
+ <?php
172
+ }
173
+
174
+ // ref
175
+ public function htcc_fb_ref_cb() {
176
+
177
+ $reference = get_option('htcc_options');
178
+ ?>
179
+ <input type="text" name="htcc_options[ref]" id="" value="<?php echo esc_attr( $reference['ref'] ) ?>">
180
+
181
+ <p class="description"><?php _e( 'WebHook Param ( this is optional, only use this if you know how it works ) - ' , 'wp-chatbot' ) ?><a target="_blank" href="https://holithemes.com/wp-chatbot/messenger-ref/"><?php _e( 'more info' , 'wp-chatbot' ) ?></a> </p>
182
+ <?php
183
+ }
184
185
// checkboxes - based on Type of posts ..
186
public function htcc_show_hide_post_types_cb() {
434
if( isset( $input['fb_sdk_lang'] ) )
435
$new_input['fb_sdk_lang'] = sanitize_text_field( $input['fb_sdk_lang'] );
436
437
+ if( isset( $input['minimized'] ) )
438
+ $new_input['minimized'] = sanitize_text_field( $input['minimized'] );
439
+
440
+ if( isset( $input['ref'] ) )
441
+ $new_input['ref'] = sanitize_text_field( $input['ref'] );
442
+
443
if( isset( $input['hideon_posts'] ) )
444
$new_input['hideon_posts'] = sanitize_text_field( $input['hideon_posts'] );
445
inc/class-htcc-chatbot.php CHANGED
@@ -19,12 +19,14 @@ class HTCC_Chatbot {
19
$htcc_fb_app_id = esc_attr( $htcc_options['fb_app_id'] );
20
$htcc_fb_page_id = esc_attr( $htcc_options['fb_page_id'] );
21
$htcc_fb_sdk_lang = esc_attr( $htcc_options['fb_sdk_lang'] );
22
23
$shortcode_name = esc_attr( $htcc_options['shortcode'] );
24
$enable = esc_attr( $htcc_options['enable'] );
25
26
/**
27
- * enable not equl to 1, means dont show the chat button.
28
* so retun out of the page.
29
*/
30
if ( '1' !== $enable ) {
@@ -144,8 +146,8 @@ class HTCC_Chatbot {
144
<div class="htcc-messenger">
145
<div class="fb-customerchat"
146
page_id="<?php echo $htcc_fb_page_id ?>"
147
- ref=""
148
- minimized="true">
149
</div>
150
</div>
151
19
$htcc_fb_app_id = esc_attr( $htcc_options['fb_app_id'] );
20
$htcc_fb_page_id = esc_attr( $htcc_options['fb_page_id'] );
21
$htcc_fb_sdk_lang = esc_attr( $htcc_options['fb_sdk_lang'] );
22
+ $htcc_fb_minimized = esc_attr( $htcc_options['minimized'] );
23
+ $htcc_fb_ref = esc_attr( $htcc_options['ref'] );
24
25
$shortcode_name = esc_attr( $htcc_options['shortcode'] );
26
$enable = esc_attr( $htcc_options['enable'] );
27
28
/**
29
+ * enable not equal to 1, means dont show the chat button.
30
* so retun out of the page.
31
*/
32
if ( '1' !== $enable ) {
146
<div class="htcc-messenger">
147
<div class="fb-customerchat"
148
page_id="<?php echo $htcc_fb_page_id ?>"
149
+ ref="<?php echo $htcc_fb_ref ?>"
150
+ minimized="<?php echo $htcc_fb_minimized ?>">
151
</div>
152
</div>
153
inc/class-htcc-db.php CHANGED
@@ -54,9 +54,10 @@ class HTCC_db {
54
55
'list_hideon_pages' => '',
56
'list_hideon_cat' => '',
57
-
58
'shortcode' => 'chatbot',
59
-
60
);
61
62
54
55
'list_hideon_pages' => '',
56
'list_hideon_cat' => '',
57
'shortcode' => 'chatbot',
58
+
59
+ 'minimized' => 'false',
60
+ 'ref' => '',
61
);
62
63
inc/class-htcc-shortcode.php CHANGED
@@ -14,25 +14,38 @@ if ( ! class_exists( 'HTCC_Shortcode' ) ) :
14
15
class HTCC_Shortcode {
16
17
function shortcode($atts = [], $content = null, $shortcode = '') {
18
19
$global_app_id = $GLOBALS["htcc_app_id"];
20
$global_page_id = $GLOBALS["htcc_page_id"];
21
$global_fb_sdk_lang = $GLOBALS["htcc_fb_sdk_lang"];
22
23
$htcc_options = get_option('htcc_options');
24
25
$a = shortcode_atts(
26
array(
27
'app_id' => $global_app_id,
28
'page_id' => $global_page_id,
29
30
), $atts, $shortcode );
31
32
33
$app_id = $a["app_id"];
34
$page_id = $a["page_id"];
35
36
$is_mobile = $GLOBALS["htcc_isMob"];
37
38
$o = '';
@@ -59,9 +72,9 @@ class HTCC_Shortcode {
59
$o .= '';
60
$o .= '<div class="htcc-messenger">
61
<div class="fb-customerchat"
62
- page_id=" '.$page_id.' "
63
- ref=""
64
- minimized="true">
65
</div>
66
</div>';
67
$o .= '';
14
15
class HTCC_Shortcode {
16
17
+
18
function shortcode($atts = [], $content = null, $shortcode = '') {
19
20
$global_app_id = $GLOBALS["htcc_app_id"];
21
$global_page_id = $GLOBALS["htcc_page_id"];
22
$global_fb_sdk_lang = $GLOBALS["htcc_fb_sdk_lang"];
23
24
+ $global_fb_min = $GLOBALS["htcc_fb_min"];
25
+ $global_fb_ref = $GLOBALS["htcc_fb_ref"];
26
+
27
$htcc_options = get_option('htcc_options');
28
29
+ /**
30
+ * min - true or false
31
+ */
32
$a = shortcode_atts(
33
array(
34
'app_id' => $global_app_id,
35
'page_id' => $global_page_id,
36
37
+ 'min' => $global_fb_min,
38
+ 'ref' => $global_fb_ref,
39
+
40
), $atts, $shortcode );
41
42
43
$app_id = $a["app_id"];
44
$page_id = $a["page_id"];
45
46
+ $min = $a["min"];
47
+ $ref = $a["ref"];
48
+
49
$is_mobile = $GLOBALS["htcc_isMob"];
50
51
$o = '';
72
$o .= '';
73
$o .= '<div class="htcc-messenger">
74
<div class="fb-customerchat"
75
+ page_id="'.$page_id.'"
76
+ ref="'.$ref.'"
77
+ minimized="'.$min.'">
78
</div>
79
</div>';
80
$o .= '';
inc/commons/variables.php CHANGED
@@ -16,6 +16,9 @@ $GLOBALS["htcc_page_id"] = esc_attr( $htcc_options['fb_page_id'] );
16
$GLOBALS["htcc_shortcode"] = esc_attr( $htcc_options['shortcode'] );
17
$GLOBALS["htcc_fb_sdk_lang"] = esc_attr( $htcc_options['fb_sdk_lang'] );
18
19
20
21
16
$GLOBALS["htcc_shortcode"] = esc_attr( $htcc_options['shortcode'] );
17
$GLOBALS["htcc_fb_sdk_lang"] = esc_attr( $htcc_options['fb_sdk_lang'] );
18
19
+ $GLOBALS["htcc_fb_min"] = esc_attr( $htcc_options['minimized'] );
20
+ $GLOBALS["htcc_fb_ref"] = esc_attr( $htcc_options['ref'] );
21
+
22
23
24
readme.txt CHANGED
@@ -11,7 +11,7 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
12
13
== Description ==
14
- Add Messenger to your website. Chat bot or live chat to your Customers from your website Messenger. build for Facebook Messenger Customer Chat plugin.
15
16
== Documentation ==
17
@@ -19,7 +19,7 @@ Live chat to your customers or integrate chatbot to messenger and let bots chat
19
20
[Documentation, Demo](https://holithemes.com/wp-chatbot/)
21
22
- This plugin is for integrate Facebook Messenger [Customer Chat plugin](https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin) in your Website.
23
24
= Tools to build Chatbots for messenger =
25
Chatfuel
@@ -38,7 +38,7 @@ Facebook Page ID
38
1. signup for Facebook Developer Account
39
1. Create an APP in Facebook Developer Account
40
1. Create Facebook Page
41
- 1. Whitelisted Domains - Facebook page -> 'settings' -> 'Messenger Platform' tab and at 'Whitelisted Domains' add domain names.
42
43
In plugin setting page - add Facebook App ID, Facebook Page ID
44
@@ -47,6 +47,18 @@ In plugin setting page - add Facebook App ID, Facebook Page ID
47
And for creating automatic messages - use tools like Chatfuel or so..
48
49
50
== Installation ==
51
52
= using FTP or similar =
@@ -73,6 +85,10 @@ And for creating automatic messages - use tools like Chatfuel or so..
73
74
== Changelog ==
75
76
= 1.3.0 =
77
* can change Language for Messenger
78
11
12
13
== Description ==
14
+ Add Messenger to your website. Chat bot or live chat to your Customers from your website using Messenger. build for Facebook Messenger Customer Chat plugin.
15
16
== Documentation ==
17
19
20
[Documentation, Demo](https://holithemes.com/wp-chatbot/)
21
22
+ This plugin adds Facebook Messenger [Customer Chat plugin](https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin) in your Website.
23
24
= Tools to build Chatbots for messenger =
25
Chatfuel
38
1. signup for Facebook Developer Account
39
1. Create an APP in Facebook Developer Account
40
1. Create Facebook Page
41
+ 1. Whitelisted Domains - From your Facebook page -> 'settings' -> 'Messenger Platform' tab and at 'Whitelisted Domains' add domain names.
42
43
In plugin setting page - add Facebook App ID, Facebook Page ID
44
47
And for creating automatic messages - use tools like Chatfuel or so..
48
49
50
+ == Screenshots ==
51
+
52
+ 1. Messenger Demo
53
+ 2. Setting page
54
+ 3. Setting page
55
+ 4. min is true
56
+ 5. min is false
57
+ 6. customer can chat from your website. ( Human chat or chat bot )
58
+ 7. Change Messenger language ( not user input )
59
+ 8. Shortcode
60
+
61
+
62
== Installation ==
63
64
= using FTP or similar =
85
86
== Changelog ==
87
88
+ = 2.0 =
89
+ * can add ref
90
+ * set chat window minimized or not
91
+
92
= 1.3.0 =
93
* can change Language for Messenger
94
wp-chatbot.php CHANGED
@@ -2,7 +2,7 @@
2
/*
3
Plugin Name: WP Chatbot for facebook Messenger
4
Description: Add Messenger to your website, Chatbot or live Chat using Facebook Messenger
5
- Version: 1.3.0
6
Author: bhvreddy
7
License: GPL2
8
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -12,7 +12,7 @@ Text Domain: wp-chatbot
12
13
if ( ! defined( 'ABSPATH' ) ) exit;
14
15
- define( 'HTCC_VERSION', '1.3.0' );
16
define( 'HTCC_WP_MIN_VERSION', '4.6' );
17
define( 'HTCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
18
define( 'HTCC_PLUGIN_FILE', __FILE__ );
2
/*
3
Plugin Name: WP Chatbot for facebook Messenger
4
Description: Add Messenger to your website, Chatbot or live Chat using Facebook Messenger
5
+ Version: 2.0
6
Author: bhvreddy
7
License: GPL2
8
License URI: https://www.gnu.org/licenses/gpl-2.0.html
12
13
if ( ! defined( 'ABSPATH' ) ) exit;
14
15
+ define( 'HTCC_VERSION', '2.0' );
16
define( 'HTCC_WP_MIN_VERSION', '4.6' );
17
define( 'HTCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
18
define( 'HTCC_PLUGIN_FILE', __FILE__ );