> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs-dev.iclosed.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Contact Updated Webhook

> Webhook event triggered when an existing contact is updated in iClosed.io

## Overview

The **Contact Updated** webhook is triggered whenever an existing contact's information is modified in your iClosed.io account. This event provides the complete updated contact object, including all current data and any changes that were made.

## Event Details

* **Event Type**: `contactUpdated`
* **Trigger**: When a contact's information is updated through any channel (form submission, manual edit, API, etc.)
* **Payload**: Complete updated contact object with all current data

## Webhook Payload

The webhook payload contains the full updated contact object with the following structure:

```json theme={null}
[
  {
    "id": 5,
    "userId": 4,
    "accountId": 3,
    "firstName": "Raya",
    "lastName": "Fleming",
    "email": "zogiji@example.com",
    "phoneNumber": null,
    "secondary_email": null,
    "secondary_phoneNumber": null,
    "status": "QUALIFIED",
    "createdAt": "2025-05-09T15:28:40.783Z",
    "previewId": "contact_-d9DGyd9xHK_",
    "timeZone": "Asia/Karachi",
    "joinedTime": "2025-05-09T15:28:40.783Z",
    "country": "PK",
    "ipAddress": "::1",
    "updatedAt": "2025-05-09T15:28:41.385Z",
    "updatedAttributes": [],
    "questionsAndAnswers": {
      "1_question": "Phone Number",
      "1_response": "+1234567890",
      "2_question": "Email Address",
      "2_response": "zogiji@example.com",
      "3_question": "Full Name",
      "3_response": "Raya Fleming",
      "4_question": "Additional Information Question 1",
      "4_response": "Additional Information Response 1",
      "5_question": "Additional Information Question 2",
      "5_response": "Additional Information Response 2",
      "6_question": "Additional Information Question 3",
      "6_response": "Additional Information Response 3",
      "7_question": "Additional Information Question 4",
      "7_response": "Additional Information Response 4",
      "Phone Number": "+1234567890",
      "Email Address": "zogiji@example.com",
      "Full Name": "Raya Fleming",
      "Additional Information Question 1": "Additional Information Response 1",
      "Additional Information Question 2": "Additional Information Response 2",
      "Additional Information Question 3": "Additional Information Response 3",
      "Additional Information Question 4": "Additional Information Response 4"
    },
    "event": {
      "id": 2,
      "name": "Discovery Event",
      "linkPrefix": "example/discovery-event",
      "color": "#0099FF",
      "eventType": "DISCOVERY_EVENT"
    },
    "tracking": {
      "first_utm_term": "",
      "first_utm_source": "",
      "first_utm_medium": "",
      "first_utm_content": "",
      "first_utm_campaign": "",
      "utm_term": "",
      "utm_source": "",
      "utm_medium": "",
      "utm_content": "",
      "utm_campaign": "",
      "utmKey_0": "",
      "utmValue_0": "",
      "utmKey_1": "",
      "utmValue_1": "",
      "utmKey_2": "",
      "utmValue_2": "",
      "utmKey_3": "",
      "utmValue_3": "",
      "utmKey_4": "",
      "utmValue_4": ""
    },
    "internal_configuration": {
      "question_answers": []
    },
    "Referrer_Url_Embed": "http://localhost:3000/app/example/discovery-event",
    "previewUrl": "http://localhost:3000/app/global-data/contacts?preview=contact_-d9DGyd9xHK_",
    "latestCall": {
      "id": 9,
      "dateTime": "2025-05-13T10:15:00.000Z",
      "timeZone": "Asia/Karachi",
      "duration": 30,
      "durationUnit": "MINUTES",
      "user": {
        "id": 4,
        "firstName": "test",
        "lastName": "",
        "email": "test@iclosed.io",
        "phoneNumber": null
      }
    },
    "disqualifyingGroup": [
      {
        "statement": "Additional Information Question 1",
        "operator": "AND",
        "value": "Additional Information Response 1",
        "condition": "IS",
        "disqualificationGroupId": 1
      },
      {
        "statement": "Additional Information Question 2",
        "operator": "AND",
        "value": "Additional Information Response 2",
        "condition": "IS",
        "disqualificationGroupId": 1
      },
      {
        "statement": "Additional Information Question 3",
        "operator": "AND",
        "value": "Additional Information Response 3",
        "condition": "IS",
        "disqualificationGroupId": 1
      }
    ],
    "hookType": "Contact updated"
  }
]
```

## Key Differences from Contact Created

### Updated Timestamps

* **`updatedAt`**: Shows when the contact was last modified
* **`createdAt`**: Remains the original creation timestamp
* **`joinedTime`**: Original join timestamp (unchanged)

### Updated Attributes Tracking

* **`updatedAttributes`**: Array of fields that were modified in this update
* This field helps identify what specific information changed

### Hook Type

* **`hookType`**: Set to "Contact updated" to distinguish from creation events

## Key Fields Explained

### Basic Contact Information

* **`id`**: Unique contact identifier (unchanged)
* **`firstName`**, **`lastName`**: Contact's name (may be updated)
* **`email`**: Primary email address (may be updated)
* **`phoneNumber`**: Primary phone number (may be updated)
* **`secondary_email`**, **`secondary_phoneNumber`**: Additional contact methods
* **`status`**: Contact qualification status (may change)

### Event Information

* **`event`**: Details about the event the contact was originally created from
  * This typically doesn't change unless the contact is moved to a different event

### Questions and Answers

* **`questionsAndAnswers`**: All current form responses from the contact
  * May include new or updated responses
  * Contains both numbered format and direct key-value pairs

### Tracking Data

* **`tracking`**: UTM parameters and tracking information
  * May be updated if new tracking data is available
  * `first_utm_*` fields preserve original attribution

### Call Information

* **`latestCall`**: Details about the most recent scheduled call
  * May be updated if new calls are scheduled
  * Includes call host information

### Disqualification Logic

* **`disqualifyingGroup`**: Any current disqualifying conditions
  * May change based on updated responses or status changes

## Use Cases

This webhook is useful for:

* **CRM Synchronization**: Keep your CRM updated with the latest contact information
* **Data Validation**: Verify that contact updates are properly processed
* **Audit Trails**: Track changes to contact information over time
* **Workflow Triggers**: Initiate follow-up actions when specific fields are updated
* **Analytics**: Monitor contact engagement and information changes
* **Lead Scoring Updates**: Re-evaluate contact quality based on new information

## Response Requirements

Your webhook endpoint should:

* Return a **2xx status code** to acknowledge receipt
* Respond within **5 seconds** to avoid retries
* Handle duplicate events (idempotency)
* Log the contact ID and updated attributes for debugging
* Consider the `updatedAttributes` field to determine what changed

## Best Practices

1. **Check `updatedAttributes`**: Use this field to identify what specifically changed
2. **Compare with Previous State**: Store previous contact state to track changes
3. **Handle Partial Updates**: Not all fields may be present in every update
4. **Validate Changes**: Ensure the updated data meets your business rules
5. **Update Timestamps**: Use `updatedAt` to determine if you have the latest data
