facebook webhook request via ajax
-
Somebody can help me. When I setup webhook on my fb app. I entered callback URL https://iconofficial.com/wp-admin/admin-ajax.php?action=message and verify token ‘9fDZwm9QRG2TL8i1aqXTernmZBa74mOw’
It return bad request 400, url couldn’t be validated
And this is my code to verify:add_action( 'admin_post_message', array( $this, 'facebook_return' ) ); add_action( 'admin_post_nopriv_message', array( $this, 'facebook_return' ) ); public function facebook_return() { $hub_verify_token = null; $verify_token = '9fDZwm9QRG2TL8i1aqXTernmZBa74mOw'; if ( isset( $_REQUEST['hub_mode'] ) && $_REQUEST['hub_mode'] == 'subscribe' ) { $challenge = $_REQUEST['hub_challenge']; $hub_verify_token = $_REQUEST['hub_verify_token']; if ( $hub_verify_token === $verify_token ) { header( 'HTTP/1.1 200 OK' ); echo $challenge; die; } } }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘facebook webhook request via ajax’ is closed to new replies.