-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: add resend provider #28
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small things to pick up before adding this feature.
@@ -20,6 +21,8 @@ public function __invoke(Request $request, string $driver): Response | |||
return response('Invalid signature.', status: 400); | |||
} | |||
|
|||
Log::channel('single')->log('info', 'Webhook received', $request->all()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed.
{ | ||
public function registerWebhooks($components): void | ||
{ | ||
// TODO: verify if we can hack the user endpoint to create a webhook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Display a console info message using $components
with webhook URL and the link to add this to Resend (https://resend.com/webhooks)
EventType::HARD_BOUNCED->value => ['type' => 'email.bounced'], | ||
EventType::OPENED->value => ['type' => 'email.opened'], | ||
EventType::SOFT_BOUNCED->value => ['type' => 'email.delivery_delayed'], | ||
EventType::UNSUBSCRIBED->value => ['type' => 'SubscriptionChange'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed if Resend does not have a subscribed event.
This pull request introduces a new email driver for the Resend service, updates the mail provider manager to include the new driver, and adds tests to verify the functionality of the Resend driver.
One of the issues may be the creation of a Webhook, however you can create it manually. I still need to do some research on it, but probably it will turn into a future update.
Key Features:
src/Drivers/ResendDriver.php
: Introduced theResendDriver
class implementingMailDriverContract
, with methods for registering webhooks, verifying webhook signatures, extracting UUIDs and timestamps from payloads, and mapping events and data.tests/ResendTest.php
: Added multiple tests to verify the Resend driver's ability to handle various webhook events, including delivery, hard bounce, soft bounce, complaint, open, and click events.