If you use SendGrid for email marketing, our free webhook connector lets you automatically push guest WiFi registration data into your SendGrid marketing contacts. Every time a guest registers on your captive portal, their details appear in SendGrid ready for your next campaign.
The connector is a lightweight PHP script that receives webhooks from the Art of WiFi captive portal and forwards the data to SendGrid’s Marketing Contacts API. No manual imports, no CSV uploads, no missed contacts.
The data flow is simple and happens in real time:
A guest connects to your WiFi and completes the captive portal registration form.
The portal fires a webhook (HTTP POST) to the connector script hosted on your server.
The connector validates the payload and immediately returns a response to the portal so the guest is not held up waiting for internet access.
In the background, the connector calls SendGrid’s Marketing Contacts API to create or update the contact.
The connector uses SendGrid’s upsert endpoint, which matches contacts by email address. New guests are created as fresh contacts; returning guests have their records updated with the latest data. Your contact list stays clean without duplicates.
These portal fields map to SendGrid’s reserved fields automatically:
Email address → email (required)
First name → first_name
Last name → last_name
Mobile phone → phone_number
Beyond the built-in fields, you can map any portal field to a SendGrid custom field. Common mappings include:
ZIP code, locale, and room number
Client device type, brand, model, OS, and browser
Terms of service acceptance and marketing consent flags
WiFi access point MAC, SSID, and client MAC address
Empty or null values are skipped, so they never overwrite existing data on returning contacts.
The portal payload includes the access point MAC address but not a human-readable location name. The connector can derive one locally by mapping AP MAC addresses to location names in its configuration file. This is especially useful when you have multiple locations or zones within a site — such as a restaurant, reception, bar, or gym — and want to segment contacts in SendGrid by the area where they connected to WiFi.
Every guest WiFi registration adds a contact to your SendGrid marketing list — or multiple lists, if you configure more than one. No manual imports or CSV uploads needed.
When a returning guest connects to WiFi, their SendGrid contact is updated with any new data. If they used a different device or visited a different location, those details are captured automatically without creating a duplicate record.
With device type, location, visit count, and marketing consent captured as custom fields, you can build targeted segments in SendGrid. Send a campaign to guests who visited a specific location, target guests who opted in to marketing, or exclude contacts who have not visited in a while.
The captive portal captures marketing consent during registration. The consent flag flows to SendGrid as a custom field, so you always know which contacts have explicitly opted in before you include them in a campaign.
The connector requires PHP 7.4 or higher, a SendGrid account with a valid API key (Marketing Campaigns permissions), and a web server that can accept HTTPS POST requests. Setup is straightforward:
Clone or download the connector source code (available free of charge).
composer install to pull in the SendGrid SDK.
Copy the configuration template and add your SendGrid API key, list IDs, and custom field mappings.
Point the captive portal’s registration webhook URL at the connector.
Guest data starts flowing to SendGrid immediately.
For a broader overview of how captive portal integrations work with email marketing platforms, see our post on using a captive portal for marketing data collection.
Questions about the SendGrid connector or need help with setup? We are happy to help.
The connector uses SendGrid’s upsert endpoint, which matches contacts by email address. Existing contacts are updated with any new data; new contacts are created. No duplicates.
Email is the only required field. If the portal registration does not include a valid email address, the connector logs the event and skips the SendGrid call. No incomplete contacts are created.
Yes. You configure one or more SendGrid list IDs in the connector configuration file. Every contact is added to all specified lists automatically.
Yes, the source code is available free of charge. It is a small PHP script that you host on your own server. Contact us if you need help with setup or customization.
The connector uses SendGrid’s Marketing Contacts API, which is available on plans that include Marketing Campaigns. Check your SendGrid plan details to confirm Marketing Campaigns is included.
Yes. The captive portal has an optional email verification step. When enabled, the guest receives an email with a one-time code and a confirmation link immediately after submitting the registration form. They are granted temporary WiFi access — with configurable duration and speed — so they can open their email app and confirm. The guest completes verification by entering the code on the captive portal or by clicking the link in the email. Only verified registrations are forwarded to SendGrid, which keeps your contact list free of typos and fake addresses.
Posted on: May 15th, 2026
By: Erik Slooff
On: Captive Portals
SendGrid
email marketing
webhooks
captive portal
marketing automation
About the author
Erik Slooff
Owner & Lead Developer
For more than 10 years I’ve specialised in UniFi® guest-WiFi solutions—ranging from email-capture and SMS phone-number verification to Azure Entra ID single-sign-on and multi-site analytics dashboards. Posting as @slooffmaster in the Ubiquiti Community, I’ve contributed 160 + posts, 8300 + replies and 300 + accepted solutions that help network admins worldwide. Today our solutions secure and provide analytics for 2500 + UniFi networks across retail, hospitality, government and education in 70 + countries. Customers use our solutions to authenticate users, meet regional privacy requirements (GDPR, CCPA, etc.) and unlock marketing or loyalty insights, and more. When I’m not refining captive-portal flows, you’ll find me benchmarking new UniFi firmware or contributing to our open-source code on GitHub.
Copyright © 2026 Art of WiFi B.V.