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.
Changes
Hey! Thank you so much for this! It's super cool!
I've made a few changes to incorporate some best practices. Feel free to push back / ask more about it.
processEventBatch
We're deprecating this with the new release that's coming out today, so I moved this plugin to a new approach using
onEvent
.onEvent
is used for plugins that need to read the event but don't modify it, as is the case here. Docs for this are coming out today.statusOk
The current checking mechanism would only match a 200, in which case it could just check if the status is equal to 200. To check for all 2xx codes, I've added in
statusOk
. Other plugins use this as well.Suggestions
I haven't tried this out myself but I'm happy to get it in and iterate from there. A few things I'd suggest, but that are not necessary at this stage:
Additional config verification
I'd check
config.eventMethodType
for example. In fact, a better choice might be to use thechoice
type with options like 'POST' and 'PUT', or whatever should be allowed. You could also check for leading slashes on the event path etc. Essentially anything that would cause an error to be thrown duringonEvent
rather thansetupPlugin
.Tests
These are always nice :D
Retry queue for failed requests
This is something that recent developments in the plugin server allow for. I'm supposed to implement a few plugins using retry queues this cycle so you could use those as an example to implement it here too. You couldn't have known this was possible yet though because the docs are also coming later today.
Questions
Do you not want to send event names to Salesforce?