Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webhook URL generation problem #99

Closed
dominik04u opened this issue Nov 23, 2017 · 3 comments
Closed

Webhook URL generation problem #99

dominik04u opened this issue Nov 23, 2017 · 3 comments
Assignees

Comments

@dominik04u
Copy link

dominik04u commented Nov 23, 2017

When I try to verify my Callback URL in FB app I have callback message like "The URL couldn't be validated. Response does not match challenge, expected value="1717583312", received="{"status":"success"}" "

I configurated all options in magento and status is of course "success", but why facebook want numeric value?

I have already read issues #31 and #60

I don't have any idea what is wrong or what I do wrong.

This is my URL: https://demo.onlineua.org/index.php/chatbot/chatdata/facebook/key/mr686WIBBp/

@blopa
Copy link
Owner

blopa commented Nov 24, 2017

Hello @dominik04u. First of all, thanks for using our module.

I got many issues requests about the Facebook Challenge Hub. This was hard to code because I needed to create a "pure text" page with no HTML tags.

Some modules add blocks to all Magento pages and it may overwrite the webhook URL, which must NOT contain any blocks. Try looking for these blocks and exclude the itby adding <remove name="BLOCK_NAME" /> at Magento-Root/app/design/frontend/base/default/layout/werules_chatbot.xml

You should also check the URL like in this #60 (comment)

Please try that and let me know.

@dominik04u
Copy link
Author

dominik04u commented Nov 26, 2017

I changed your code a little. I changed this method:

`public function verifyWebhook($hub_token) {
			if ($this->data['hub_verify_token'] == $hub_token) {
				return $this->data['hub_challenge'];
			}
			return false;
		}

to this:

public function verifyWebhook($hub_token) {
			if ($_REQUEST['hub_verify_token'] == $hub_token) {
				return $_REQUEST['hub_challenge'];
			}
			return false;
}

because it always was null in my case., because $rawData = file_get_contents("php://input"); always was null. Then the URL callback in fb was saved. I send messages to my bot, but it still doesn't work. I don't know why php://input was null, and I don't know if messages are receive. Do you have idea what can be wrong?

--UPDATE--

I added this in php.ini

allow_url_fopen = on

allow_url_include = on

Callback URL works only with $_REQUEST

@dominik04u
Copy link
Author

Ok. I repaired this, but I have another problem. Your plugin wants information like
$this->data["entry"][0]["messaging"][0]["referral"]["ref"]
or
$this->data["entry"][0]["messaging"][0]["postback"]["payload"];
but request from facebook doesn't have them.

@blopa blopa self-assigned this Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants