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

# Lead Note Events

> Triggered when notes are added, updated, or removed from leads

## Event Types

* **`lead_note_created`** - Note added to lead
* **`lead_note_updated`** - Lead note modified
* **`lead_note_deleted`** - Note removed from lead

## Webhook Details

**Event IDs**: `lead_note_created`, `lead_note_updated`, `lead_note_deleted`\
**Content-Type**: `application/json`\
**Method**: `POST`

## Authentication

All webhooks include JWT authentication in the Authorization header:

<CodeGroup>
  ```javascript Node.js theme={null}
  const jwt = require('jsonwebtoken');

  app.post('/webhook', (req, res) => {
    const token = req.headers.authorization?.split('Bearer ')[1];
    
    try {
      const decoded = jwt.verify(token, process.env.INTEGRATION_UUID);
      console.log('Event:', decoded.event_id); // 'lead_note_created'
      console.log('Company:', decoded.company_uuid);
      
      const { note, configuration } = req.body;
      // Process note data...
      
      res.status(200).send('OK');
    } catch (error) {
      res.status(401).send('Invalid token');
    }
  });
  ```

  ```python Python theme={null}
  import jwt
  from flask import Flask, request

  app = Flask(__name__)

  @app.route('/webhook', methods=['POST'])
  def webhook():
      token = request.headers.get('Authorization', '').replace('Bearer ', '')
      
      try:
          decoded = jwt.decode(token, os.getenv('INTEGRATION_UUID'), algorithms=['HS256'])
          print(f"Event: {decoded['event_id']}")  # 'lead_note_created'
          print(f"Company: {decoded['company_uuid']}")
          
          payload = request.json
          note = payload['note']
          # Process note data...
          
          return 'OK', 200
      except jwt.InvalidTokenError:
          return 'Invalid token', 401
  ```
</CodeGroup>

## JWT Token Payload

<ResponseField name="company_uuid" type="string">
  UUID of the company where the note was created
</ResponseField>

<ResponseField name="user_uuid" type="string">
  UUID of the user who created the note
</ResponseField>

<ResponseField name="event_id" type="string">
  Always `lead_note_created` for this event
</ResponseField>

<ResponseField name="api_key" type="string">
  Your integration's API key
</ResponseField>

## Webhook Payload Schema

<ResponseField name="note" type="object">
  The created note object

  <Expandable title="note object">
    <ResponseField name="uuid" type="string">
      Unique identifier for the note
    </ResponseField>

    <ResponseField name="created_at" type="number">
      Unix timestamp when note was created
    </ResponseField>

    <ResponseField name="document" type="string">
      Note content (parsed from TipTap JSON to plain text)
    </ResponseField>

    <ResponseField name="user_uuid" type="string">
      UUID of the user who created the note
    </ResponseField>

    <ResponseField name="user_email" type="string">
      Email of the user who created the note
    </ResponseField>

    <ResponseField name="user_first_name" type="string">
      First name of the user who created the note
    </ResponseField>

    <ResponseField name="user_last_name" type="string">
      Last name of the user who created the note
    </ResponseField>

    <ResponseField name="lead_uuid" type="string">
      UUID of the lead this note is attached to
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="configuration" type="array">
  Integration configuration settings for field mapping

  <Expandable title="configuration items">
    <ResponseField name="id" type="string">
      Configuration section ID
    </ResponseField>

    <ResponseField name="selected" type="array">
      Selected configuration options

      <Expandable title="selected items">
        <ResponseField name="id" type="string">
          Option ID
        </ResponseField>

        <ResponseField name="value" type="string">
          Selected value
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Payload

```json theme={null}
{
  "note": {
    "uuid": "note_98765432-2109-8765-4321-987654321098",
    "created_at": 1716214515227,
    "document": "Had a great call with Jane from Prospect Company. They're very interested in our enterprise solution and mentioned they have budget approved for Q2. Key requirements: integration with their existing CRM, support for 150+ users, and advanced reporting capabilities. Next steps: send proposal by Friday and schedule demo for next week.",
    "user_uuid": "user_12345678-1234-5678-9012-123456789abc",
    "user_email": "sales@company.com",
    "user_first_name": "Sales",
    "user_last_name": "Rep",
    "lead_uuid": "lead_5336ba48-2ee0-4565-bbf7-f938d51042c1"
  },
  "configuration": []
}
```

## Notes

* Webhook is sent when a note is added to a lead in JourneyBee
* JWT token must be verified using your Integration UUID as the secret
* Note content is converted from TipTap JSON format to plain text
* Configuration array is typically empty for note events
