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

Send queued webhooks in reversed chronological order #4627

Conversation

escopecz
Copy link
Member

@escopecz escopecz commented Aug 9, 2017

Q A
Bug fix? N
New feature? Hardly
Related user documentation PR URL /
Related developer documentation PR URL mautic/developer-documentation#68
Issues addressed (#s or URLs) /
BC breaks? N
Deprecations? N

Description:

Zapier requires to send queued webhook entities in reversed chronological order:

https://zapier.com/developer/documentation/v2/deduplication/

To keep BC, this PR adds 2 new options to configure the order. One is in the Mautic configuration and that option is taken as a default one for all webhooks. The default value of that field is ASC, so it will work as before.

Another option is to configure the order for every webhook. That's what we need for Zapier.

Steps to test this PR:

  1. Before you checkout: Make sure you have webhooks configured to be queued instead of sent immediately.
  2. Create a new webhook with some actions you can easily trigger multiple times. Like contact update for example. You may use my testing script to catch the whole webhook request. Request Bin will strip the longer request body so you won't be able to confirm the order.
  3. Trigger the actions at least 3 times.
  4. Run 'app/console mautic:webhooks:process` command to trigger.
  5. Notice the contact's dateModified is oldest at the top and latest at the bottom.
  6. Apply this PR.
  7. Repeat 3. and 4. Notice the order is still the same = BC.
  8. Try to change order in the Mautic configuration to Reverse Chronological.
  9. Fire some events again - the order is from latest to oldest.
  10. Change the order in your webhook to Chronological.
  11. Fire some events again - the order is from oldest to latest. The webhook's config overwrote the global config.
  12. Run new API Library tests: Webhooks event order api-library#127

@escopecz escopecz added feature A new feature for inclusion in minor or major releases ready-to-test PR's that are ready to test labels Aug 9, 2017
@escopecz escopecz added this to the 2.10.0 milestone Aug 9, 2017
@escopecz escopecz added WIP PR's that are not ready for review and are currently in progress and removed ready-to-test PR's that are ready to test labels Aug 9, 2017
@escopecz escopecz added ready-to-test PR's that are ready to test and removed WIP PR's that are not ready for review and are currently in progress labels Aug 10, 2017
@dongilbert dongilbert self-assigned this Aug 18, 2017
@alanhartless alanhartless self-assigned this Aug 18, 2017
@dongilbert dongilbert removed their assignment Aug 22, 2017
@dongilbert dongilbert added pending-test-confirmation PR's that require one test before they can be merged and removed ready-to-test PR's that are ready to test labels Aug 23, 2017
@Gregy Gregy assigned Gregy and unassigned alanhartless Aug 24, 2017
@Gregy Gregy merged commit 6d29b19 into mautic:staging Aug 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature for inclusion in minor or major releases pending-test-confirmation PR's that require one test before they can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants