Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Dec 4, 2023
1 parent 3254191 commit dcb4581
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/Services/Mailcoach/MailcoachApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Services\Mailcoach;

use Exception;
use Illuminate\Support\Facades\Http;

class MailcoachApi
Expand All @@ -10,12 +11,18 @@ public function getSubscriber(string $email, string $listUuid = null): ?Subscrib
{
$listUuid ??= '4af46b59-3784-41a5-9272-6da31afa3a02';

$response = Http::timeout(10)->withToken(config('services.mailcoach.token'))
->get("https://spatie.mailcoach.app/api/email-lists/{$listUuid}/subscribers", [
'filter' => [
'email' => $email,
],
]);

try {
$response = Http::timeout(10)->withToken(config('services.mailcoach.token'))
->get("https://spatie.mailcoach.app/api/email-lists/{$listUuid}/subscribers", [
'filter' => [
'email' => $email,
],
]);
} catch (Exception $e) {
return null;
}


if (! $response->successful()) {
return null;
Expand Down

0 comments on commit dcb4581

Please sign in to comment.