Browse documentation

Submit uDrew leads to Neptune

Use the udrewIntake endpoint to create or update a lead from a uDrew submission.

On this page

1. udrewIntake

Use this endpoint for inbound lead submissions from the uDrew website lead generator.

Request

  • Method: POST
  • Headers:
    • Content-Type: application/json
    • x-api-key: <your-uDrew-api-key>

Authentication

The API key must be an active Neptune organisation API key for the uDrew integration.

You can generate this in Neptune under Admin → Integrations → uDrew.

Request body

All body fields are optional in the current implementation. However, for a useful lead record you should normally send at least one identifying field such as name, email, phone, address, or sessionId.

FieldTypeRequiredNotes
addressstringNoPostal or site address for the lead
firstNamestringNoLead first name
lastNamestringNoLead last name
emailstringNoLead email address
phonestringNoLead phone number
messagestringNoFree-text enquiry message
sessionIdstringNoIf provided, Neptune uses this to find and update an existing uDrew lead instead of creating a new one
latitude`number \string`No
longitude`number \string`No
featureIdstringNoOptional uDrew feature identifier
featureIDstringNoAlternative accepted key for featureId
featureNamestringNoOptional uDrew feature name
featureTypestringNoOptional uDrew feature type
imageDatastringNoBase64 image string, with or without a data:image/...;base64, prefix

Example body

{
  "address": "12 Example Street, Bristol",
  "firstName": "Jamie",
  "lastName": "Taylor",
  "email": "jamie@example.com",
  "phone": "07700111222",
  "message": "Interested in a pool design",
  "sessionId": "udrew-session-12345",
  "latitude": 51.4545,
  "longitude": -2.5879,
  "featureId": "feature_456",
  "featureName": "Rectangle Pool",
  "featureType": "pool",
  "imageData": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}

Example request

curl -X POST "https://us-central1-netpune-220210.cloudfunctions.net/udrewIntake" \
  -H "Content-Type: application/json" \
  -H "x-api-key: <your-uDrew-api-key>" \
  -d '{
    "address": "12 Example Street, Bristol",
    "firstName": "Jamie",
    "lastName": "Taylor",
    "email": "jamie@example.com",
    "phone": "07700111222",
    "message": "Interested in a pool design",
    "sessionId": "udrew-session-12345",
    "latitude": 51.4545,
    "longitude": -2.5879,
    "featureId": "feature_456",
    "featureName": "Rectangle Pool",
    "featureType": "pool",
    "imageData": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
  }'

What Neptune does

  1. Validates the x-api-key.
  2. Looks for an existing udrewLeads record with the same sessionId if one is provided.
  3. Updates that record if found, or creates a new one if not found.
  4. Saves feature metadata if featureId, featureID, featureName, or featureType are provided.
  5. Converts latitude and longitude into a Neptune latLng value when both coordinates are present and valid numbers.
  6. Uploads imageData to storage if it is present.
  7. Returns the Neptune lead record ID.

If image upload fails, Neptune still continues processing the lead submission and returns success if the lead itself was saved.

If the organisation has Neptune sequencing enabled, Neptune may also create a Lead record automatically from the uDrew submission.

Field handling notes

  • Neptune accepts either featureId or featureID. If both are present, featureId is used.
  • Neptune only saves location data when both latitude and longitude are provided and can be parsed into valid numbers.
  • When sequencing is enabled, the saved latLng value is also copied onto the auto-created Lead record.

Success response

{
  "ok": true,
  "leadId": "abc123",
  "isUpdate": false
}
FieldTypeNotes
okbooleantrue when the request succeeded
leadIdstringNeptune ID of the udrewLeads record
isUpdatebooleantrue when an existing record was matched by sessionId and updated

Error responses

StatusErrorWhen it happens
401invalid_api_keyAPI key is missing, revoked, invalid, or not for the uDrew integration
405method_not_allowedRequest method is not POST
500internal_errorUnexpected server-side failure