Comments

grahl created an issue. See original summary.

grahl’s picture

Status: Active » Needs review
StatusFileSize
new3.14 KB

When adding the URL with the hash seen in the backend UI to Mailchimp the endpoint is added successfully. However, the Drupal backend always fails with "We couldn't verify the URL is working. Please double check and try again. HTTP Code: 403"

This presumably happens since the webhook url generated uses a different technique to generate a hash which the endpoint does not use.

The patch removes the unnecessary key generation function mailchimp_webhook_key(), removes the unused function mailchimp_process_webhook_access() using it as well and generates a proper link in mailchimp_webhook_url() with language prefixes present. Also some minor UI tweak to show that as well in the backend form.

jayelless’s picture

Thanks @grahl. The patch in #2 has enabled me to activate the webhooks in my site. I am running 8.x-1.11.

playful’s picture

#2 also works for me on 8.x-1.11.

kristofferrom’s picture

Patch not working for me unfortunaly. Getting:

An error occurred adding webhook for list 966580d1fa. "400: Invalid Resource - The resource submitted could not be validated. For field-specific details, see the 'errors' array. a:1:{i:0;O:8:"stdClass":2:{s:5:"field";s:3:"url";s:7:"message";s:88:"We couldn't verify the URL is working. Please double check and try again. HTTP Code: 403";}}"
anouar_dhawadi’s picture

Hello,
Me also i encountered the same problem:

An error occurred adding webhook for list 22f416b5ce. "400: Invalid Resource - The resource submitted could not be validated. For field-specific details, see the 'errors' array. a:1:{i:0;O:8:"stdClass":2:{s:5:"field";s:3:"url";s:7:"message";s:88:"We couldn't verify the URL is working. Please double check and try again. HTTP Code: 403";}}"

brendanthinkshout’s picture

StatusFileSize
new3.38 KB

Rerolling to apply @grahl's solution to the current code, but this still needs testing. @jlscott, @playful, can you offer a little more detail about which webhooks you were able to successfully activate? @kristofferrom, @anouar_dhawadi, what about you? Is it possible that the condition of a site having one or multiple languages active makes a difference here?

grahl’s picture

Is it possible that the condition of a site having one or multiple languages active makes a difference here?

If they are part of the URL, yes it does, at least in terms of if the form in Drupal is showing a webhook as active or not. You can verify this by changing the language prefix in your path and see the value change. (You can also verify the hook being present in the other language or potentially multiple langauges in the Mailchimp backend.)

A pragmatic solution could be to enforce the default language in the webhook form since the hook isn't language dependent. That would avoid looking through all possible registered language-specific hook URLs.

brendanthinkshout’s picture

Assigned: Unassigned » brendanthinkshout
StatusFileSize
new1.3 KB

Aha, something like this then?

brendanthinkshout’s picture

StatusFileSize
new3.17 KB

Let's try that with a patch that applies.

Status: Needs review » Needs work

The last submitted patch, 10: 3091699-10-fix_webhook_hash.patch, failed testing. View results

vladimiraus’s picture

Status: Needs work » Needs review
StatusFileSize
new506 bytes
new3 KB

Looks like test was failing due to global object.

Status: Needs review » Needs work

The last submitted patch, 12: mailchimp-fix_webhook_hash-3091699-12.patch, failed testing. View results

vladimiraus’s picture

Status: Needs work » Needs review
StatusFileSize
new2.12 KB
new4.11 KB
gcb’s picture

Version: 8.x-1.x-dev » 2.0.0
gcb’s picture

Re-rolled patch against 2.x branch, with improvements to translatability on the admin screen and making use of the `mailchimp_webhook_url` function for DRY/consistency.

gcb’s picture

Assigned: brendanthinkshout » gcb

  • gcb committed 3997248 on 2.x
    Issue #3091699 by brendanthinkshout, VladimirAus, grahl, gcb: Webhooks...
gcb’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.