CP-12376 extend webhooks partnerships#55
Merged
ryanarakawa merged 11 commits intomainfrom Feb 18, 2026
Merged
Conversation
- add migration to make account_id OR partnership_id required, you can use either, but can and must use at least one - add PARTNERSHIP_EVENTS constant to constrain webhook firing to just template events
- 11 webhook jobs all used the same retry logic (except one file that had 12 max retries instead of 10. - remove and replace duplicated code - add retry logic for partnership templates
- add for_template method to support account/partnership templates. - for_account_id will still work for submissions - update controllers with new method - I'm not great with Arel, so I refactored since I wanted account/partnership to use a shared method.
The immediately following PR will add this `after_commit` back. We only really need the upcoming template.preferences_updated webhook event that will be in the next PR, so even though it's unlikely anyone will be testing this at the Partnership level right now, better to just remove it for the time being for a cleaner PR.
ryanarakawa
commented
Feb 17, 2026
app/models/partnership.rb
Outdated
| author: author) | ||
| end | ||
|
|
||
| def create_careerplug_webhook |
Collaborator
Author
There was a problem hiding this comment.
This will get added back in the next PR. The only event we'll be using, template.preferences_updated will be in the next PR.
Collaborator
bernardodsanderson
left a comment
There was a problem hiding this comment.
This looks good!
|
|
||
| def event_matcher(events) | ||
| events = Array.wrap(events) | ||
| conditions = events.map { 'events LIKE ?' }.join(' OR ') |
Collaborator
There was a problem hiding this comment.
[optional] Not a huge risk, but there is a possibility of SQL injection here. One possible thing to do is to validate them against a constant.
bernardodsanderson
approved these changes
Feb 18, 2026
* safety against SQL injection This method does not accept user input, but adding this just to be safe.
* since we added the events constant checker, we need to make sure this event is part of the constant list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends the webhook system to support partnerships in addition to accounts, enabling partnership-level webhook notifications for template webhook events.
Changes:
partnership_idtowebhook_urlstable with database constraint (webhooks belong to either account OR partnership)WebhookRetryLogicmoduleWebhookUrlsmodule with routing for templates (account/partnership)after_commitcallbackManual Testing