feat: add custom headers and data unflattening to webhook actions#83
Open
jignaciopm wants to merge 1 commit intomasterfrom
Open
feat: add custom headers and data unflattening to webhook actions#83jignaciopm wants to merge 1 commit intomasterfrom
jignaciopm wants to merge 1 commit intomasterfrom
Conversation
magajh
reviewed
Jan 16, 2026
Contributor
There was a problem hiding this comment.
LGTM! If we’ve tested this on a remote instance and are confident it works as expected, then we can close this PR.
@jignaciopm we need to update the changelog entry and bump the plugin version. I'll leave my approval once those changes are pushed
d5ca1af to
10180eb
Compare
10180eb to
87a2e30
Compare
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.
This PR introduces several improvements to the post_to_webhook_url action to make it more flexible when integrating with third-party services (like Accredible, Make, or custom APIs) that require specific headers or nested JSON structures.
Key Changes
1. Custom HTTP Headers
Users can now define a
headersobject in their trigger settings. This is crucial for services requiring API Keys or Bearer tokens."headers": {"Authorization": "Token secret_abc"}2. Data Unflattening (
unflatten_data)Many 3rd party services expect nested JSON rather than flat "dot-notated" strings. We've added a utility that transforms:
{"user.email": "test@test.com"}{"user": {"email": "test@test.com"}}3. Course Context Injection
By setting
use_course_information: true, the webhook will now resolve and include the fullcourseobject in the context, even if the initial trigger only provided certificate data.Technical Details
unflatten_dicttoutils.pywith support for custom delimiters.get_certificateto avoid code duplication inactions.py.Testing Executed
test_post_to_webhook_url_with_custom_headersto verify header injection.test_unflatten_dict_default_delimiterandtest_unflatten_dict_custom_delimiterto ensure the recursion logic is sound.unflatten_dictcorrectly handles leaf-node assignment viasetdefault.Testing instructions
Environment Setup:
Manual Test:
Trigger the configured event (e.g., generate a certificate for a learner).
Check the receiving end (e.g., Webhook.site) to verify that the incoming request contains both the Authorization and X-Custom-Header headers.
Automated Tests:
Run the updated unit tests:
Confirm that test_post_to_webhook_url_with_custom_headers and test_post_to_webhook_url_without_headers_in_config pass successfully.
Additional information
Checklist for Merge