Webhooks provide a powerful way to receive real-time updates from third-party services directly into your Laravel application. When integrating Adobe Sign, you can track document events like agreement creation, signature completion, and cancellation using its webhook system. In this blog post, we’ll walk through how to consume Adobe Sign webhooks in Laravel securely and effectively.
π§ Step 1: Understand Adobe Sign Webhooks
Adobe Sign webhooks notify your application when specific events happen. Common events include:
AGREEMENT_CREATED
AGREEMENT_VIEWED
AGREEMENT_SIGNED
AGREEMENT_CANCELLED
Adobe will:
- Send a GET request to your endpoint to validate it when you register the webhook.
- Send a POST request on every actual event, including headers for security verification.
π Step 2: Create a Webhook Route in Laravel
Add the webhook endpoint to your routes/api.php
file:
use App\Http\Controllers\AdobeWebhookController;
Route::match(['get', 'post'], '/webhooks/adobe-sign', [AdobeWebhookController::class, 'handle']);
This allows Adobe to perform both the initial GET request and subsequent POST payload deliveries.
π Step 3: Build the Webhook Controller
In app/Http/Controllers/AdobeWebhookController.php
:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class AdobeWebhookController extends Controller
{
public function handle(Request $request)
{
// 1. Webhook validation ping (GET request)
if ($request->isMethod('get')) {
return response('Webhook endpoint verified', 200);
}
// 2. Validate the Adobe webhook signature (basic match method)
$signature = $request->header('X-AdobeSign-ClientId');
$expected = config('services.adobe.webhook_secret');
if ($signature !== $expected) {
Log::warning('Invalid Adobe Sign webhook signature.');
return response('Unauthorized', 401);
}
// 3. Process the event
$event = $request->input('event');
Log::info('Adobe Sign Webhook Event Received', $event);
switch ($event['eventType']) {
case 'AGREEMENT_CREATED':
// Store agreement metadata in DB
break;
case 'AGREEMENT_SIGNED':
// Update document status in DB
break;
case 'AGREEMENT_CANCELLED':
// Notify user or take corrective actions
break;
}
return response('OK', 200);
}
}
π Step 4: Secure Your Webhook
In your .env
file:
ADOBE_WEBHOOK_SECRET=your-adobe-client-id
In config/services.php
:
'adobe' => [
'webhook_secret' => env('ADOBE_WEBHOOK_SECRET'),
]
This helps protect against spoofed webhook events. Adobe includes the X-AdobeSign-ClientId
header, which should match the expected value.
πΉ Step 5: Test Your Webhook Locally
Use a tool like ngrok to expose your local Laravel API endpoint:
ngrok http 8000
Use the public URL generated (e.g., https://abc123.ngrok.io/api/webhooks/adobe-sign
) as the webhook endpoint in Adobe Sign.
π’ Step 6: Example Adobe Webhook Payload
Here’s a sample payload Adobe might send:
{
"event": {
"eventType": "AGREEMENT_SIGNED",
"agreementId": "AGREEMENT123",
"participantEmail": "john@example.com",
"timestamp": "2025-05-09T10:30:00Z"
}
}
Use this structure to parse event types and act accordingly.
πΎ Best Practices for Adobe Sign Webhooks in Laravel
- Queue the processing of webhook events using Laravel Jobs.
- Use logging to trace webhook interactions.
- Avoid duplicate processing by storing a hash or event ID.
- Respond quickly to the webhook (within 5 seconds) to avoid Adobe retries.
- Version your endpoint if your logic may change.
π Bonus: Extending with Jobs
// Inside your controller:
use App\Jobs\ProcessAdobeEvent;
ProcessAdobeEvent::dispatch($event);
And your job might look like:
namespace App\Jobs;
class ProcessAdobeEvent implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $event;
public function __construct(array $event) { $this->event = $event; }
public function handle()
{
switch ($this->event['eventType']) {
case 'AGREEMENT_SIGNED':
// Update database or send email
break;
}
}
}
π Final Thoughts
Adobe Sign webhook integration in Laravel is straightforward but powerful. With proper routing, signature validation, and event processing via queues, you can build scalable and responsive document automation workflows.
This setup is ideal for:
- Legal document status tracking
- eSign approval systems
- Contract management platforms
- Automated follow-ups and notifications
With Adobeβs powerful webhook capabilities and Laravelβs backend flexibility, you have everything needed to build seamless signing workflows.
Comments