Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Handling Typeform Webhooks in Laravel
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class WebhookController
public function create(Request $request)
abort_unless($this->typeformSignatureMatches($request), 403);
$answers = collect($request->input('form_response.answers'))
->transform(function ($answer) {
return $answer[$answer['type']];
// Then you can use form values directly from the collection, e.g.:
protected function typeformSignatureMatches(Request $request)
$body = $request->getContent();
$provided_signature = $request->header('Typeform-Signature');
$actual_signature = 'sha256=' . base64_encode(hash_hmac('sha256', $body, env('TYPEFORM_SECRET'), true));
return $provided_signature === $actual_signature;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment