Skip to content

Bug Report: Webhook Creation Requires event_types Field #3

@fazmain

Description

@fazmain

Description

When attempting to create a webhook via the AgentMail API, the request fails with a validation error indicating that the event_types field is required but missing from the API documentation and examples.

Error Details

{
  "name": "ValidationError",
  "errors": [
    {
      "expected": "array",
      "code": "invalid_type", 
      "path": ["event_types"],
      "message": "Invalid input: expected array, received undefined"
    }
  ]
}

Steps to Reproduce

  1. Follow the setup instructions in the sales-agent README
  2. Execute the webhook creation command:
curl -X POST https://api.agentmail.to/v0/webhooks \
     -H "Authorization: Bearer $AGENTMAIL_API_KEY" \
     -H "Content-Type: application/json" \
     -d "{
  \"url\": \"https://$WEBHOOK_DOMAIN/webhooks\"
}"

Expected Behavior

The webhook should be created successfully with just the url parameter as shown in the documentation.

Actual Behavior

The API returns a validation error requiring an event_types field that is not documented or provided in the example.

Environment

  • API Version: v0
  • Endpoint: /v0/webhooks
  • Method: POST

Documentation Issue

The current documentation shows:

{
  "url": "https://$WEBHOOK_DOMAIN/webhooks"
}

But the API appears to require:

{
  "url": "https://$WEBHOOK_DOMAIN/webhooks",
  "event_types": ["email_received", "email_sent"]
}

Request

Please either:

  1. Update the documentation to include the required event_types field with example values
  2. Make the event_types field optional if it's not always required
  3. Provide clear error messages that specify which fields are required

Additional Context

This affects the sales-agent example setup process and prevents users from completing the webhook configuration step.

Labels

bug api documentation webhook

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions