WP-Chatbot for Facebook Messenger Customer Chat - Version 1.1.0

Version Description

  • show / hide messenger based on page types
  • Hide messenger based on post id, category name.
Download this release

Release Info

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

Code changes from version 1.0.0 to 1.1.0

admin/class-htcc-admin.php CHANGED
@@ -26,12 +26,12 @@ class HTCC_Admin {
26
*/
27
public function htcc_options_page() {
28
add_menu_page(
29
- 'customer chat',
30
- 'customer-chat',
31
'manage_options',
32
- 'customer-chat',
33
array( $this, 'settings_page' ),
34
- 'dashicons-heart'
35
);
36
}
37
@@ -70,10 +70,14 @@ class HTCC_Admin {
70
register_setting( 'htcc_settings_group', 'htcc_options' , array( $this, 'htcc_options_sanitize' ) );
71
72
add_settings_section( 'htcc_settings', '', array( $this, 'htcc_settings_section_cb' ), 'htcc_options_settings' );
73
-
74
add_settings_field( 'htcc_fb_app_id', 'Facebook App ID', array( $this, 'htcc_fb_app_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
75
add_settings_field( 'htcc_fb_page_id', 'Facebook Page ID', array( $this, 'htcc_fb_page_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
76
77
}
78
79
// section heading
@@ -81,7 +85,17 @@ class HTCC_Admin {
81
echo '<h1>Customer Chat - Settings</h1>';
82
}
83
84
-
85
86
public function htcc_fb_app_id_cb() {
87
@@ -106,6 +120,165 @@ class HTCC_Admin {
106
}
107
108
109
110
111
@@ -127,12 +300,42 @@ class HTCC_Admin {
127
128
$new_input = array();
129
130
if( isset( $input['fb_app_id'] ) )
131
$new_input['fb_app_id'] = sanitize_text_field( $input['fb_app_id'] );
132
133
if( isset( $input['fb_page_id'] ) )
134
$new_input['fb_page_id'] = sanitize_text_field( $input['fb_page_id'] );
135
136
return $new_input;
137
}
138
26
*/
27
public function htcc_options_page() {
28
add_menu_page(
29
+ 'WP-Chatbot Setting page',
30
+ 'WP-Chatbot',
31
'manage_options',
32
+ 'wp-chatbot',
33
array( $this, 'settings_page' ),
34
+ 'dashicons-format-chat'
35
);
36
}
37
70
register_setting( 'htcc_settings_group', 'htcc_options' , array( $this, 'htcc_options_sanitize' ) );
71
72
add_settings_section( 'htcc_settings', '', array( $this, 'htcc_settings_section_cb' ), 'htcc_options_settings' );
73
+ add_settings_field( 'enable', 'Enable', array( $this, 'htcc_enable_cb' ), 'htcc_options_settings', 'htcc_settings' );
74
add_settings_field( 'htcc_fb_app_id', 'Facebook App ID', array( $this, 'htcc_fb_app_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
75
add_settings_field( 'htcc_fb_page_id', 'Facebook Page ID', array( $this, 'htcc_fb_page_id_cb' ), 'htcc_options_settings', 'htcc_settings' );
76
77
+ add_settings_field( 'htcc_show_hide', 'Show / Hide', array( $this, 'htcc_show_hide_post_types_cb' ), 'htcc_options_settings', 'htcc_settings' );
78
+
79
+ add_settings_field( 'htcc_list_id_tohide', 'Posts, Pages Id\'s to Hide', array( $this, 'htcc_list_id_tohide_cb' ), 'htcc_options_settings', 'htcc_settings' );
80
+ add_settings_field( 'htcc_list_cat_tohide', 'Categorys to Hide', array( $this, 'htcc_list_cat_tohide_cb' ), 'htcc_options_settings', 'htcc_settings' );
81
}
82
83
// section heading
85
echo '<h1>Customer Chat - Settings</h1>';
86
}
87
88
+ public function htcc_enable_cb() {
89
+ $enable = get_option('htcc_options');
90
+ ?>
91
+ <div>
92
+ <select name="htcc_options[enable]" class="select-1">
93
+ <option value="no">No</option>
94
+ <option value="1" <?php echo esc_attr( $enable['enable'] ) == '1' ? 'SELECTED' : ''; ?> >Yes</option>
95
+ </select>
96
+ </div>
97
+ <?php
98
+ }
99
100
public function htcc_fb_app_id_cb() {
101
120
}
121
122
123
+ // checkboxes - based on Type of posts ..
124
+ public function htcc_show_hide_post_types_cb() {
125
+ $htcc_checkbox = get_option('htcc_options');
126
+
127
+ // Single Posts
128
+ if ( isset( $htcc_checkbox['showon_posts'] ) ) {
129
+ ?>
130
+ <p>
131
+ <input name="htcc_options[showon_posts]" type="checkbox" value="1" <?php checked( $htcc_checkbox['showon_posts'], 1 ); ?> id="filled-in-box1" />
132
+ <label for="filled-in-box1">Posts</label>
133
+ </p>
134
+ <?php
135
+ } else {
136
+ ?>
137
+ <p>
138
+ <input name="htcc_options[showon_posts]" type="checkbox" value="1" id="filled-in-box1" />
139
+ <label for="filled-in-box1">Posts</label>
140
+ </p>
141
+ <?php
142
+ }
143
+
144
+
145
+ // Page
146
+ if ( isset( $htcc_checkbox['showon_page'] ) ) {
147
+ ?>
148
+ <p>
149
+ <input name="htcc_options[showon_page]" type="checkbox" value="1" <?php checked( $htcc_checkbox['showon_page'], 1 ); ?> id="filled-in-box2" />
150
+ <label for="filled-in-box2">Pages</label>
151
+ </p>
152
+ <?php
153
+ } else {
154
+ ?>
155
+ <p>
156
+ <input name="htcc_options[showon_page]" type="checkbox" value="1" id="filled-in-box2" />
157
+ <label for="filled-in-box2">Pages</label>
158
+ </p>
159
+ <?php
160
+ }
161
+
162
+
163
+ // Home Page
164
+ if ( isset( $htcc_checkbox['showon_homepage'] ) ) {
165
+ ?>
166
+ <p>
167
+ <input name="htcc_options[showon_homepage]" type="checkbox" value="1" <?php checked( $htcc_checkbox['showon_homepage'], 1 ); ?> id="filled-in-box3" />
168
+ <label for="filled-in-box3">Home Page</label>
169
+ </p>
170
+ <?php
171
+ } else {
172
+ ?>
173
+ <p>
174
+ <input name="htcc_options[showon_homepage]" type="checkbox" value="1" id="filled-in-box3" />
175
+ <label for="filled-in-box3">Home Page</label>
176
+ </p>
177
+ <?php
178
+ }
179
+
180
+
181
+ /* Front Page
182
+ A front page is also a home page, but home page is not a front page
183
+ if front page unchecked - it works on both homepage and fornt page
184
+ but if home page is unchecked - it works only on home page, not on front page */
185
+ if ( isset( $htcc_checkbox['showon_frontpage'] ) ) {
186
+ ?>
187
+ <p>
188
+ <input name="htcc_options[showon_frontpage]" type="checkbox" value="1" <?php checked( $htcc_checkbox['showon_frontpage'], 1 ); ?> id="filled-in-box4" />
189
+ <label for="filled-in-box4">Front Page</label>
190
+ </p>
191
+ <?php
192
+ } else {
193
+ ?>
194
+ <p>
195
+ <input name="htcc_options[showon_frontpage]" type="checkbox" value="1" id="filled-in-box4" />
196
+ <label for="filled-in-box4">Front Page</label>
197
+ </p>
198
+ <?php
199
+ }
200
+
201
+
202
+
203
+ // Category
204
+ if ( isset( $htcc_checkbox['showon_category'] ) ) {
205
+ ?>
206
+ <p>
207
+ <input name="htcc_options[showon_category]" type="checkbox" value="1" <?php checked( $htcc_checkbox['showon_category'], 1 ); ?> id="filled-in-box5" />
208
+ <label for="filled-in-box5">Category</label>
209
+ </p>
210
+ <?php
211
+ } else {
212
+ ?>
213
+ <p>
214
+ <input name="htcc_options[showon_category]" type="checkbox" value="1" id="filled-in-box5" />
215
+ <label for="filled-in-box5">Category</label>
216
+ </p>
217
+ <?php
218
+ }
219
+
220
+
221
+
222
+ // Archive
223
+ if ( isset( $htcc_checkbox['showon_archive'] ) ) {
224
+ ?>
225
+ <p>
226
+ <input name="htcc_options[showon_archive]" type="checkbox" value="1" <?php checked( $htcc_checkbox['showon_archive'], 1 ); ?> id="filled-in-box6" />
227
+ <label for="filled-in-box6">Archive</label>
228
+ </p>
229
+ <?php
230
+ } else {
231
+ ?>
232
+ <p>
233
+ <input name="htcc_options[showon_archive]" type="checkbox" value="1" id="filled-in-box6" />
234
+ <label for="filled-in-box6">Archive</label>
235
+ </p>
236
+ <?php
237
+ }
238
+
239
+
240
+
241
+ // 404 Page
242
+ if ( isset( $htcc_checkbox['showon_404'] ) ) {
243
+ ?>
244
+ <p>
245
+ <input name="htcc_options[showon_404]" type="checkbox" value="1" <?php checked( $htcc_checkbox['showon_404'], 1 ); ?> id="filled-in-box7" />
246
+ <label for="filled-in-box7">404 Page</label>
247
+ </p>
248
+ <?php
249
+ } else {
250
+ ?>
251
+ <p>
252
+ <input name="htcc_options[showon_404]" type="checkbox" value="1" id="filled-in-box7" />
253
+ <label for="filled-in-box7">404 Page</label>
254
+ </p>
255
+ <?php
256
+ }
257
+ ?>
258
+ <p class="description"> check to show, uncheck to hide <br> Show/ Hide Messenger - based on type of the page <a target="_blank" href="">more info</a> </p>
259
+
260
+
261
+ <?php
262
+ }
263
+
264
+
265
+ // ID 's list to hide styles
266
+ function htcc_list_id_tohide_cb() {
267
+ $htcc_list_id_tohide = get_option('htcc_options');
268
+ ?>
269
+ <input name="htcc_options[list_hideon_pages]" value="<?php echo esc_attr( $htcc_list_id_tohide['list_hideon_pages'] ) ?>" id="htcc_list_id_tohide" type="text">
270
+ <p class="description"> Add Post, Pages, Media - ID's to hide, <br> can add multiple id's separate with comma ( , ) - <a target="_blank" href="https://holithemes.com/whatsapp-chat/show-hide-styles-based-on-id/">more info</a> </p>
271
+ <?php
272
+ }
273
+
274
+ // Categorys list - to hide
275
+ function htcc_list_cat_tohide_cb() {
276
+ $htcc_list_cat_tohide = get_option('htcc_options');
277
+ ?>
278
+ <input name="htcc_options[list_hideon_cat]" value="<?php echo esc_attr( $htcc_list_cat_tohide['list_hideon_cat'] ) ?>" id="htcc_list_cat_tohide" type="text" >
279
+ <p class="description"> Category name's to hide, <br> can add multiple Categories separate with comma ( , ) - <a target="_blank" href="https://holithemes.com/whatsapp-chat/hide-styles-based-on-category/">more info</a> </p>
280
+ <?php
281
+ }
282
283
284
300
301
$new_input = array();
302
303
+ if( isset( $input['enable'] ) )
304
+ $new_input['enable'] = sanitize_text_field( $input['enable'] );
305
+
306
if( isset( $input['fb_app_id'] ) )
307
$new_input['fb_app_id'] = sanitize_text_field( $input['fb_app_id'] );
308
309
if( isset( $input['fb_page_id'] ) )
310
$new_input['fb_page_id'] = sanitize_text_field( $input['fb_page_id'] );
311
312
+ if( isset( $input['showon_posts'] ) )
313
+ $new_input['showon_posts'] = sanitize_text_field( $input['showon_posts'] );
314
+
315
+ if( isset( $input['showon_page'] ) )
316
+ $new_input['showon_page'] = sanitize_text_field( $input['showon_page'] );
317
+
318
+ if( isset( $input['showon_homepage'] ) )
319
+ $new_input['showon_homepage'] = sanitize_text_field( $input['showon_homepage'] );
320
+
321
+ if( isset( $input['showon_frontpage'] ) )
322
+ $new_input['showon_frontpage'] = sanitize_text_field( $input['showon_frontpage'] );
323
+
324
+ if( isset( $input['showon_category'] ) )
325
+ $new_input['showon_category'] = sanitize_text_field( $input['showon_category'] );
326
+
327
+ if( isset( $input['showon_archive'] ) )
328
+ $new_input['showon_archive'] = sanitize_text_field( $input['showon_archive'] );
329
+
330
+ if( isset( $input['showon_404'] ) )
331
+ $new_input['showon_404'] = sanitize_text_field( $input['showon_404'] );
332
+
333
+ if( isset( $input['list_hideon_pages'] ) )
334
+ $new_input['list_hideon_pages'] = sanitize_text_field( $input['list_hideon_pages'] );
335
+
336
+ if( isset( $input['list_hideon_cat'] ) )
337
+ $new_input['list_hideon_cat'] = sanitize_text_field( $input['list_hideon_cat'] );
338
+
339
return $new_input;
340
}
341
inc/chatbot.php DELETED
@@ -1,44 +0,0 @@
1
- <?php
2
- /**
3
- * get app id
4
- * get page id
5
- * and add it to script, div
6
- */
7
-
8
- if ( ! defined( 'ABSPATH' ) ) exit;
9
-
10
- $htcc_options = get_option('htcc_options');
11
-
12
- $htcc_fb_app_id = esc_attr( $htcc_options['fb_app_id'] );
13
- $htcc_fb_page_id = esc_attr( $htcc_options['fb_page_id'] );
14
-
15
- ?>
16
-
17
-
18
-
19
- <script>
20
- window.fbAsyncInit = function() {
21
- FB.init({
22
- appId : '<?php echo $htcc_fb_app_id ?>',
23
- autoLogAppEvents : true,
24
- xfbml : true,
25
- version : 'v2.11'
26
- });
27
- };
28
-
29
- (function(d, s, id){
30
- var js, fjs = d.getElementsByTagName(s)[0];
31
- if (d.getElementById(id)) {return;}
32
- js = d.createElement(s); js.id = id;
33
- js.src = "https://connect.facebook.net/en_US/sdk.js";
34
- fjs.parentNode.insertBefore(js, fjs);
35
- }(document, 'script', 'facebook-jssdk'));
36
- </script>
37
-
38
-
39
-
40
- <div class="fb-customerchat"
41
- page_id="<?php echo $htcc_fb_page_id ?>"
42
- ref=""
43
- minimized="true">
44
- </div>
inc/class-htcc-chatbot.php ADDED
@@ -0,0 +1,138 @@
1
+ <?php
2
+ /**
3
+ * get app id
4
+ * get page id
5
+ * and add it to script, div
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit;
9
+
10
+ if ( ! class_exists( 'HTCC_Chatbot' ) ) :
11
+
12
+ class HTCC_Chatbot {
13
+
14
+ public static function chatbot() {
15
+
16
+ $htcc_options = get_option('htcc_options');
17
+
18
+ $htcc_fb_app_id = esc_attr( $htcc_options['fb_app_id'] );
19
+ $htcc_fb_page_id = esc_attr( $htcc_options['fb_page_id'] );
20
+
21
+
22
+ $enable = esc_attr( $htcc_options['enable'] );
23
+
24
+ /**
25
+ * enable not equl to 1, means dont show the chat button.
26
+ * so retun out of the page.
27
+ */
28
+ if ( '1' !== $enable ) {
29
+ return;
30
+ }
31
+
32
+
33
+
34
+
35
+
36
+ if ( is_single() && !isset( $htcc_options['showon_posts'] ) ) {
37
+ return;
38
+ }
39
+
40
+ if ( is_page() && !isset( $htcc_options['showon_page'] ) ) {
41
+ return;
42
+ }
43
+
44
+ if ( is_home() && !isset( $htcc_options['showon_homepage'] ) ) {
45
+ return;
46
+ }
47
+
48
+ if ( is_front_page() && !isset( $htcc_options['showon_frontpage'] ) ) {
49
+ return;
50
+ }
51
+
52
+ if ( is_category() && !isset( $htcc_options['showon_category'] ) ) {
53
+ return;
54
+ }
55
+
56
+ if ( is_archive() && !isset( $htcc_options['showon_archive'] ) ) {
57
+ return;
58
+ }
59
+
60
+ if ( is_404() && !isset( $htcc_options['showon_404'] ) ) {
61
+ return;
62
+ }
63
+
64
+
65
+ $this_page_id = get_the_ID();
66
+ $pages_list_tohide = $htcc_options['list_hideon_pages'];
67
+ $pages_list_tohide_array = explode(',', $pages_list_tohide);
68
+
69
+ if( ( is_single() || is_page() ) && in_array( $this_page_id, $pages_list_tohide_array ) ) {
70
+ return;
71
+ }
72
+
73
+ // #do - add if loop, that this category .. run if some category added to hide.
74
+ // i.e. if $htcc_options['list_hideon_cat']; is not null.
75
+
76
+ // Get current post Categorys list and create an array for that..
77
+ $current_categorys_array = array();
78
+ $current_categorys = get_the_category();
79
+ foreach ( $current_categorys as $category ) {
80
+ $current_categorys_array[] = strtolower($category->name);
81
+ }
82
+
83
+ // Hide styles on this catergorys - list
84
+ $list_hideon_cat = $htcc_options['list_hideon_cat'];
85
+ $list_hideon_cat_array = explode(',', $list_hideon_cat);
86
+
87
+ foreach ( $list_hideon_cat_array as $category ) {
88
+ $category_trim = trim($category);
89
+ if ( in_array( strtolower($category_trim), $current_categorys_array ) ) {
90
+ return;
91
+ }
92
+ }
93
+
94
+
95
+ ?>
96
+
97
+
98
+
99
+ <script>
100
+ window.fbAsyncInit = function() {
101
+ FB.init({
102
+ appId : '<?php echo $htcc_fb_app_id ?>',
103
+ autoLogAppEvents : true,
104
+ xfbml : true,
105
+ version : 'v2.11'
106
+ });
107
+ };
108
+
109
+ (function(d, s, id){
110
+ var js, fjs = d.getElementsByTagName(s)[0];
111
+ if (d.getElementById(id)) {return;}
112
+ js = d.createElement(s); js.id = id;
113
+ js.src = "https://connect.facebook.net/en_US/sdk.js";
114
+ fjs.parentNode.insertBefore(js, fjs);
115
+ }(document, 'script', 'facebook-jssdk'));
116
+ </script>
117
+
118
+
119
+ <div class="htcc-messenger">
120
+ <div class="fb-customerchat"
121
+ page_id="<?php echo $htcc_fb_page_id ?>"
122
+ ref=""
123
+ minimized="true">
124
+ </div>
125
+ </div>
126
+
127
+
128
+ <?php
129
+ }
130
+ }
131
+
132
+
133
+
134
+ $chatbot = new HTCC_Chatbot();
135
+ add_action( 'wp_footer', array( $chatbot, 'chatbot' ) );
136
+
137
+
138
+ endif; // END class_exists check
inc/class-htcc-db.php ADDED
@@ -0,0 +1,79 @@
1
+ <?php
2
+ /**
3
+ * Database - values
4
+ * plugin details
5
+ * plugin settings - options page
6
+ */
7
+
8
+ if ( ! defined( 'ABSPATH' ) ) exit;
9
+
10
+ if ( ! class_exists( 'HTCC_db' ) ) :
11
+
12
+ class HTCC_db {
13
+
14
+
15
+ /**
16
+ * Add plugin Details to db - wp_options table
17
+ * Add plugin version to db - useful while updating plugin
18
+ *
19
+ * @uses class-htcc-register -> activate()
20
+ * @return void
21
+ */
22
+ public static function db_plugin_details() {
23
+
24
+ // plugin details
25
+ $plugin_details = array(
26
+ 'version' => HTCC_VERSION,
27
+ );
28
+
29
+ // Always use update_option - override new values .. don't preseve already existing values
30
+ update_option( 'htcc_plugin_details', $plugin_details );
31
+ }
32
+
33
+
34
+
35
+
36
+ /**
37
+ * options page - default values.
38
+ *
39
+ * @uses class-htcc-register -> activate()
40
+ * @return void
41
+ */
42
+ public static function db_default_values() {
43
+
44
+ /**
45
+ * plugin details
46
+ *
47
+ * @key enable - 1, means true. show the button.
48
+ */
49
+ $values = array(
50
+ 'enable' => '1',
51
+ 'fb_app_id' => '510187842699385',
52
+ 'fb_page_id' => '135269407170658',
53
+
54
+ 'showon_posts' => '1',
55
+ 'showon_page' => '1',
56
+ 'showon_homepage' => '1',
57
+ 'showon_frontpage' => '1',
58
+ 'showon_category' => '1',
59
+ 'showon_archive' => '1',
60
+ 'showon_404' => '1',
61
+
62
+ 'list_hideon_pages' => '',
63
+ 'list_hideon_cat' => '',
64
+ );
65
+
66
+
67
+ // update_option( 'htcc_options', $values );
68
+ // add_option( 'htcc_options', $values );
69
+
70
+ $db_values = get_option( 'htcc_options', array() );
71
+ $update_values = array_merge($values, $db_values);
72
+ update_option('htcc_options', $update_values);
73
+ }
74
+
75
+
76
+
77
+ }
78
+
79
+ endif; // END class_exists check
inc/class-htcc-register.php CHANGED
@@ -34,9 +34,10 @@ class HTCC_Register {
34
}
35
36
// update plugin details to wp_options table
37
- self::db_plugin_details();
38
39
- self::db_default_values();
40
41
}
42
@@ -82,41 +83,6 @@ class HTCC_Register {
82
}
83
}
84
85
- /**
86
- * Add plugin Details to db - wp_options table
87
- * Add plugin version to db - useful while updating plugin
88
- *
89
- * @uses self::activate()
90
- * @return void
91
- */
92
- public static function db_plugin_details() {
93
-
94
- // plugin details
95
- $plugin_details = array(
96
- 'version' => HTCC_VERSION,
97
- );
98
-
99
- // Always use update_option - override new values .. don't preseve already existing values
100
- update_option( 'htcc_plugin_details', $plugin_details );
101
- }
102
-
103
-
104
- public static function db_default_values() {
105
-
106
- // plugin details
107
- $values = array(
108
- 'fb_app_id' => '510187842699385',
109
- 'fb_page_id' => '135269407170658',
110
- );
111
-
112
-
113
- // update_option( 'htcc_options', $values );
114
- // add_option( 'htcc_options', $values );
115
-
116
- $db_values = get_option( 'htcc_options', array() );
117
- $update_values = array_merge($values, $db_values);
118
- update_option('htcc_options', $update_values);
119
- }
120
121
}
122
34
}
35
36
// update plugin details to wp_options table
37
+ HTCC_db::db_plugin_details();
38
39
+ // default values
40
+ HTCC_db::db_default_values();
41
42
}
43
83
}
84
}
85
86
87
}
88
readme.txt CHANGED
@@ -5,16 +5,19 @@ Requires PHP: 5.6
5
Contributors: bhvreddy
6
Donate link: https://www.paypal.me/ugadi
7
Stable tag: trunk
8
- Tags: messanger chatbot, customer chat, facebook customer chat, facebook chat plugin, chatbot
9
License: GPLv2 or later
10
License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
12
13
14
== Description ==
15
- Chat with Customer from your website using Messanger bot.
16
17
== Documentation ==
18
Build for Facebook Customer chat plugin - Integrate your Messenger bot directly into your website
19
20
= Requires =
@@ -23,24 +26,22 @@ Facebook APP ID
23
Facebook Page ID
24
25
( if you already done this no need to do again )
26
1. signup for Facebook Developer Account
27
1. Create an APP
28
1. Create a Page
29
- 1. Whitelisted Domains - Facebook page -> settings -> Messenger Platform
30
- and at 'Whitelisted Domains' add domain name.
31
32
- in plugin setting page
33
add Facebook App ID, Facebook Page ID
34
35
- and for creating automatic messages - chatbot - use chatfuel or some other tools
36
37
- more info - https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin
38
39
- == screenshots ==
40
41
- 1. Demo
42
- 1. Facebook App ID
43
- 1. Facebook Page ID
44
45
46
== Installation ==
@@ -69,5 +70,9 @@ more info - https://developers.facebook.com/docs/messenger-platform/discovery/cu
69
70
== Changelog ==
71
72
= 1.0.0 =
73
* Initial release.
5
Contributors: bhvreddy
6
Donate link: https://www.paypal.me/ugadi
7
Stable tag: trunk
8
+ Tags: messanger chatbot, customer chat, facebook customer chat, facebook chat plugin, chatbot, messanger
9
License: GPLv2 or later
10
License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
12
13
14
== Description ==
15
+ Chat your Customer from your website using Facebook Messanger. can integrate chatbots, Customer chat plugin for Facebook Messenger
16
17
== Documentation ==
18
+
19
+ [Documentation, Demo](https://holithemes.com/wp-chatbot/)
20
+
21
Build for Facebook Customer chat plugin - Integrate your Messenger bot directly into your website
22
23
= Requires =
26
Facebook Page ID
27
28
( if you already done this no need to do again )
29
+
30
1. signup for Facebook Developer Account
31
1. Create an APP
32
1. Create a Page
33
+ 1. Whitelisted Domains - Facebook page -> 'settings' -> 'Messenger Platform' tab and at 'Whitelisted Domains' add domain names.
34
35
+ In plugin setting page
36
add Facebook App ID, Facebook Page ID
37
38
+ we create a bot which explain [settings](http://m.me/135269407170658)
39
40
+ the same can check in Messenger from [Demo website](https://holithemes.com/wp-chatbot/) located at bottom right.
41
42
+ This plugin build based on Facebook Messenger [customer chat](https://developers.facebook.com/docs/messenger-platform/discovery/customer-chat-plugin)
43
44
+ and for creating automatic messages - use tools like Chatfuel or some other tools
45
46
47
== Installation ==
70
71
== Changelog ==
72
73
+ = 1.1.0 =
74
+ * show / hide messenger based on page types
75
+ * Hide messenger based on post id, category name.
76
+
77
= 1.0.0 =
78
* Initial release.
customer-chat.php → wp-chatbot.php RENAMED
@@ -1,8 +1,8 @@
1
<?php
2
/*
3
Plugin Name: WP Chatbot
4
- Description: Customer chat plugin for Facebook
5
- Version: 1.0.0
6
Author: bhvreddy
7
License: GPL2
8
License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -12,13 +12,14 @@ Text Domain: htcc_text
12
13
if ( ! defined( 'ABSPATH' ) ) exit;
14
15
- define( 'HTCC_VERSION', '1.0.0' );
16
define( 'HTCC_WP_MIN_VERSION', '3.1.0' );
17
define( 'HTCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
18
define( 'HTCC_PLUGIN_FILE', __FILE__ );
19
20
21
// include in admin and public pages ( non-admin )
22
require_once('inc/class-htcc-register.php');
23
24
@@ -30,8 +31,8 @@ require_once('inc/class-htcc-register.php');
30
if ( is_admin() ) {
31
require_once('admin/admin.php');
32
} else {
33
- require_once('inc/chatbot.php');
34
-
35
}
36
37
/**
1
<?php
2
/*
3
Plugin Name: WP Chatbot
4
+ Description: Chat to your from Facebook Messenger, can integrate chatbots
5
+ Version: 1.1.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', '1.1.0' );
16
define( 'HTCC_WP_MIN_VERSION', '3.1.0' );
17
define( 'HTCC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
18
define( 'HTCC_PLUGIN_FILE', __FILE__ );
19
20
21
// include in admin and public pages ( non-admin )
22
+ require_once('inc/class-htcc-db.php');
23
require_once('inc/class-htcc-register.php');
24
25
31
if ( is_admin() ) {
32
require_once('admin/admin.php');
33
} else {
34
+ require_once('inc/class-htcc-chatbot.php');
35
+
36
}
37
38
/**