User Properties

Stream user properties and updates to Aampe in realtime

Overview

The Aampe Webhook allows clients to send user properties and corresponding user property updates to our system. Each event must contain specific information about the user and the properties for that user that are being created or updated. This document describes the API endpoint, request format, and response details.

API Endpoint

HOST https://ingestion.api.aampe.com

ROUTE /v1/properties

Description

This endpoint handles user properties coming to an Aampe Webhook.

Request Headers

  • Authorization (required): A valid API key in the format Bearer <token>

Request Body

The payload for this endpoint should be a JSON object with the following structure:

FieldRequiredDescription
contact_idYesThe unique ID of the user whose properties are being updated.
event_nameYesThe name of the property update event (typically "aampe_property_update")
timestampYesUnix timestamp representing when the event occurred.
event_idNoOptional unique ID of the event. Defaults to a UUID if not provided.
user_propertiesYesA JSON object containing the properties to update and their new values
metadataNoOptional JSON object representing any extra metadata associated with the event.

Example Request Payload

{
  "contact_id": "user123",
  "event_name": "aampe_property_update",
  "time": 1672531200,
  "event_id": "e3b0c442-98fc-4e4e-a83f-5f7d7edc2f38",
  "user_properties": {
    "subscription_status": "active",
    "last_login": 1672531200,
  },
  "metadata": {
    "platform": "web",
    "browser": "Chrome"
  }
}

Response

  • Status Code:
    • 202 ACCEPTED: The property update was successfully received and queued for processing
    • 401 UNAUTHORIZED: The provided API key is invalid or missing.
    • 422 UNPROCESSABLE ENTITY: The request payload is invalid. The error response will contain details about the specific validation issues.

Successful Response

Status Code:

202 Accepted

If the property update is successfully processed, the server will respond with a 202 Accepted status code, indicating that the update has been accepted and is being processed asynchronously.

Error Responses

401 Unauthorized

Reason: Missing or invalid API key in the Authorization header.

{  
  "detail": "Invalid API Key"  
}

422 Unprocessable Entity

Reason: Validation error in the request body. This error occurs if the JSON payload does not conform to the expected schema.

Response Format:

{  
  "detail": [  
    {  
      "loc": ["body", "field_name"],  
      "msg": "error message describing the issue",  
      "type": "error_type"  
    }  
  ]  
}

Notes

  • Ensure that the Authorization header is included with a valid JWT token for the request to be processed.
  • The metadata field is optional, but if included, it must be a valid JSON object.