Automate Email Marketing from Guest WiFi Data with Our SendGrid Webhook Connector

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.

How the webhook connector works

The data flow is simple and happens in real time:

  1. A guest connects to your WiFi and completes the captive portal registration form.

  2. The portal fires a webhook (HTTP POST) to the connector script hosted on your server.

  3. The connector validates the payload and immediately returns a response to the portal so the guest is not held up waiting for internet access.

  4. 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.

What data is synced

Built-in field mapping

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

Custom field mapping

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.

Location name from access point

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.

Benefits for your email marketing

Automatic list building

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.

Contact enrichment on repeat visits

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.

Segmentation and targeting

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.

Marketing consent built in

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.

Getting started

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:

  1. Clone or download the connector source code (available free of charge).

  2. composer install to pull in the SendGrid SDK.

  3. Copy the configuration template and add your SendGrid API key, list IDs, and custom field mappings.

  4. Point the captive portal’s registration webhook URL at the connector.

  5. 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.

Frequently Asked Questions

Does the connector update existing contacts or create duplicates?

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.

What if a guest does not provide an email address?

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.

Can I add contacts to specific SendGrid lists?

Yes. You configure one or more SendGrid list IDs in the connector configuration file. Every contact is added to all specified lists automatically.

Is the connector source code available?

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.

Does this work with all SendGrid plans?

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.

Can the captive portal verify email addresses before they reach SendGrid?

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

Share this on social media

About the author

Erik Slooff's avatar.

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.