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

# Partner Events

> Triggered when partnerships are created, updated, or when contacts are managed

## Event Types

* **`partner_created`** - New partnership established
* **`partner_updated`** - Partnership information changed
* **`partner_contact_created`** - New contact added to partnership
* **`partner_contact_updated`** - Partner contact information changed

## Webhook Details

**Event IDs**: `partner_created`, `partner_updated`, `partner_contact_created`, `partner_contact_updated`\
**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); // 'partner_created'
      console.log('Company:', decoded.company_uuid);
      
      const { partnership, configuration } = req.body;
      // Process partnership 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']}")  # 'partner_created'
          print(f"Company: {decoded['company_uuid']}")
          
          payload = request.json
          partnership = payload['partnership']
          # Process partnership 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 that established the partnership
</ResponseField>

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

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

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

## Webhook Payload Schema

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

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

    <ResponseField name="company_name" type="string">
      Partner company name
    </ResponseField>

    <ResponseField name="company_domain" type="string">
      Partner company email domain
    </ResponseField>

    <ResponseField name="company_website" type="string">
      Partner company website URL
    </ResponseField>

    <ResponseField name="company_description" type="string">
      Partner company description
    </ResponseField>

    <ResponseField name="company_email" type="string">
      Partner company contact email
    </ResponseField>

    <ResponseField name="company_phone_number" type="string">
      Partner company phone number
    </ResponseField>

    <ResponseField name="country_uuid" type="string">
      UUID of the partner's country
    </ResponseField>

    <ResponseField name="country_label" type="string">
      Partner's country name
    </ResponseField>

    <ResponseField name="industry_uuid" type="string">
      UUID of the partner's industry
    </ResponseField>

    <ResponseField name="industry_label" type="string">
      Partner's industry name
    </ResponseField>

    <ResponseField name="stage_uuid" type="string">
      UUID of the partnership stage
    </ResponseField>

    <ResponseField name="stage_label" type="string">
      Partnership stage name
    </ResponseField>

    <ResponseField name="category_uuid" type="string">
      UUID of the partnership category
    </ResponseField>

    <ResponseField name="category_label" type="string">
      Partnership category name
    </ResponseField>

    <ResponseField name="tier_uuid" type="string">
      UUID of the partnership tier
    </ResponseField>

    <ResponseField name="tier_label" type="string">
      Partnership tier name
    </ResponseField>

    <ResponseField name="custom_fields" type="array">
      Array of custom field values

      <Expandable title="custom_fields items">
        <ResponseField name="uuid" type="string">
          Custom field UUID
        </ResponseField>

        <ResponseField name="label" type="string">
          Custom field display name
        </ResponseField>

        <ResponseField name="type" type="string">
          Field type: `text`, `textarea`, `number`, `date`, `boolean`, `select`, `multi_select`
        </ResponseField>

        <ResponseField name="value" type="object">
          Field value object with type-specific structure
        </ResponseField>

        <ResponseField name="custom_field_value_uuid" type="string">
          UUID of the field value record
        </ResponseField>

        <ResponseField name="options" type="array">
          Available options for select/multi\_select fields
        </ResponseField>
      </Expandable>
    </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 (e.g., `partner_integration_settings`)
    </ResponseField>

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

      <Expandable title="selected items">
        <ResponseField name="id" type="string">
          Option ID (e.g., `unique_field_partner`)
        </ResponseField>

        <ResponseField name="value" type="string">
          Selected value (e.g., `company_domain`)
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Payload

```json theme={null}
{
  "partnership": {
    "uuid": "partnership_12345678-1234-5678-9012-123456789abc",
    "company_name": "TechCorp Solutions",
    "company_domain": "techcorp.com",
    "company_website": "https://www.techcorp.com",
    "company_description": "Leading provider of enterprise software solutions",
    "company_email": "partnerships@techcorp.com",
    "company_phone_number": "+1-555-987-6543",
    "country_uuid": "country_11111111-1111-1111-1111-111111111111",
    "country_label": "United States",
    "industry_uuid": "industry_22222222-2222-2222-2222-222222222222",
    "industry_label": "Technology",
    "stage_uuid": "stage_33333333-3333-3333-3333-333333333333",
    "stage_label": "Active Partner",
    "category_uuid": "category_44444444-4444-4444-4444-444444444444",
    "category_label": "Technology Partner",
    "tier_uuid": "tier_55555555-5555-5555-5555-555555555555",
    "tier_label": "Gold",
    "custom_fields": [
      {
        "uuid": "cf_66666666-6666-6666-6666-666666666666",
        "label": "Partnership Start Date",
        "type": "date",
        "value": { "date": "2024-01-15T00:00:00.000Z" },
        "custom_field_value_uuid": "cfv_77777777-7777-7777-7777-777777777777",
        "options": null
      }
    ]
  },
  "configuration": [
    {
      "id": "partner_integration_settings",
      "selected": [
        {
          "id": "unique_field_partner",
          "value": "company_domain"
        }
      ]
    }
  ]
}
```

## Notes

* Webhook is sent when a new partnership is established in JourneyBee
* JWT token must be verified using your Integration UUID as the secret
* Custom fields array may be empty if no custom fields are configured
* Configuration array contains your integration's field mapping settings
