openapi: 3.0.0
info:
  version: 1.0.0
  title: Events webhook configurations using epilot webhooks API
  description: >
    The epilot `Webhook service` provides the possibility to subscribe to epilot
    public events. This will allow you to receive notifications with payload to
    your configured webhook URL every time events happen in your account.

    This document describes the steps how to configure hooks, subscribe to events and how to manage those configurations. Service is reachable using https connection to ensure encryption between client and service.


    Webhooks can be comfortably configured and managed by admin users in epilot portal.


    # Available events
      For an overview about all events you can subscribe to with Webhooks you can call following endpoint `/webhooks/configured-events`. The response will contain a list of event names and their labels in form:
      * **eventName**: Name for identifying the event.
      * **eventLabel**: Either a user friendly label, or the eventName itself.
      When using the UI, you have the list of the available events in the drop down menu in webhook management form.
    Following Events are available for subscription:
      * [**customer request**](#tag/events_schema): generated on incoming requests from JB Journeys

    In [Events Schemas](#tag/events_schema) section you find the schemas of available events ready to register.


    # Create Webhook
      To secure your client server connection, please setup your webhook using endpoints supporting encryption, preferably [TLS](https://en.wikipedia.org/wiki/HTTPS). So we ensure encrypted data transfer to your server.
      An easy way to create webhook is to use the webhook ui in the epilot portal. You can set up your webhook configuration using the management form, and fill in there details about the webhook endpoint, event types and [authorization information](#section/Create-webhook/Authentication). However you still can use our API in the same way.
      To subscribe to an event using the API please use the `/v1/webhooks/configs` endpoint and post your receiver endpoint settings:

      | field | Required | Description |
      | ------- | --------| --------|
      | eventName  | required | epilot event you want to subscribe. see [Which events are available](#section/Create-Webhook/Which-events-are-available)|
      | url  | required | your endpoint where you want to receive the payload |
      | httpMethod | required | http method |
      | enabled | optional  |boolean whether the webhook is active or not |
      | auth | required |your endpoint authentication information. See [Authentication](#section/Create-Webhook/Authentication)|
      | filter  | optional |filter options, here you have the possibility to filter events, by product categories for example |

      ## Authentication
      We assume that your event handler endpoint is secured, we support currently following authentication types:
      * [Basic authentication](#section/Create-Webhook/Authentication/Basic-Authentication)
      * [Oauth](#section/Create-Webhook/Authentication/Oauth)
      * [API key](#section/Create-Webhook/Authentication/API-key)

      Further details on how to set up your authentication information using the API:
      ### Basic Authentication

      If you are using basic authentication you can set up the `auth` field
      | field | Required | Description |
      | ------- | --------| --------|
      | authType | required | "BASIC" |
      | basicAuthConfig | required | object only if authType is BASIC |

      **basicAuthConfig**:
      | field | Required | Description |
      | ------- | --------| --------|
      | username | required | valid username for your endpoint |
      | password | required | password |

      ### Oauth

      In case your endpoint is secured using Oauth your `Auth` should have following structure:
      | field | Required | Description |
      | ------- | --------| --------|
      | authType | required | "OAUTH_CLIENT_CREDENTIALS" |
      | oauthConfig | required | object only if authType is OAUTH_CLIENT_CREDENTIALS |

      **oauthConfig**:
      | field | Required | Description |
      | ------- | --------| --------|
      | clientId | required | your app Oauth client Id |
      | clientSecret | required | Oauth client secret |
      | endpoint | required | HTTPS endpoint for authentication |
      | httpMethod | required | HTTP methods like GET, POST... |

      ### API key

      We support also endpoints secured using API keys. In this case your webhook set up could be configured this way:

      | field | Required | Description |
      | ------- | --------| --------|
      | authType * | "API_KEY" |
      | apiKeyConfig * | object only if authType is API_KEY |

      **apiKeyConfig**:
      | field | Required | Description |
      | ------- | --------| --------|
      | keyName | required | used key name |
      | keyValue | required | value of the used key |

      ## Enable Filtering

      For better software integration you have the possibility to set up more granular filter for your subscribed events. For this please make use of the filter option when you create a webhook.
      Please note that the entire event will be sent when the filter matches.

      Using our ui in epilot portal, you can enable the filter option, and select items to be filtered.

      Using the webhook API, here more details about the possible and required fields.

      | field | Required | Description |
      | ------- | --------| --------|
      | keyToFilter | required | field of payload you want to filter |
      | supportedValues | required | list of values you want to receive |

      The subscribed events are simply a json structure, to have a filter in place for specific field in the event, you just set the `keyToFilter` value to be the field attribute structure of the json.

      For example you have the following event structure and you want your filter to apply only auth type :

      ```
      keyToFilter: {
        id,
        name,
        security{
          auth{
            type // basic|apikey|oauth|none
          }
        }
      }
      ```

      the `keyToFilter` should be `keyToFilter.security.auth`. And possible values should be set in `supportedValues` field.

      Please note that the `supportedValues` are **case sensitive**.

      Following example will filter this sample event to send only events having auth types basic and oauth.

      ```
       filter: {
          keyToFilter: 'keyToFilter.security.auth',
          supportedValues: ['basic','oauth']
        }
      ```

      **Sample filter:**

      For `Customer request` event you can filter events and receive only events related to specific product category:
      ```
       filter: {
          keyToFilter: 'customer_request.request_items.product_category',
          supportedValues: ['solar','electricity']
        }
      ```

      # List configured webhooks

      The `/v1/webhooks/configs` endpoint provides the list of the configured webhooks by your organization in following structure:

      | field | Description |
      | ------- | --------|
      |id	| webhook id |
      |eventName	|subscribed event name|
      |url |	configured client endpoint Url|
      |creationTime| webhook creation time|
      |httpMethod	| configured http method|
      |enabled	| boolean whether the webhook is enabled or not|
      |auth	| Auth settings if set|
      |filter	| filter settings if set|

      # Delete webhook
      To delete configured webhook using the ui, just hit the delete button for the wanted webhook configuration.
      To delete a webhook configuration using the API please use the `/v1/webhooks/configs/{WebhookId}` endpoint with `DELETE` http call.

      After deleting a webhook configuration you are still able to fetch failed and successfully sent events related to the deleted configuration.

      To retrieve webhook id you can query the configured webhooks, see [List configured Webhooks](#section/List-configured-Webhooks).

      # Edit Webhook
      Using the ui in the epilot portal you can very easily edit a webhook config. You will be asked to edit the pre filled form.
      To update a webhook configuration using the API please use following endpoint `/v1/webhooks/configs/{WebhookId}` using `PUT` http method.
      To retrieve webhook id you can query the configured webhooks, see [List configured Webhooks](#section/List-configured-Webhooks).

      Additional to this path parameters, the payload to update the webhook configuration is the same we use for creating new webhooks. You can also refer to [Which events are available](#section/Create-Webhook) for more details.

      To deactivate or reactivate a webhook configuration, you can make use of this endpoint, providing the organization id and webhook id as path parameter, and your payload should contain same configuration saved except the field `enabled` should either `false` if you want to deactivate the webhook otherwise `true` if the webhook should be active.
  termsOfService: https://epilot.cloud/agb
  contact:
    name: Support
    email: info@epilot.cloud
    url: https://help.epilot.cloud
tags:
  - name: webhooks
  - name: events_schema
    x-displayName: customer request event schema
    description: |
      <SchemaDefinition schemaRef="#/components/schemas/customer_request" />
  - name: events_schema_product_updated
    x-displayName: product updated event schema
    description: |
      <SchemaDefinition schemaRef="#/components/schemas/product_updated" />
  - name: events_schema_automation_rule_triggered
    x-displayName: automation rule triggered event schema
    description: >
      <SchemaDefinition
      schemaRef="#/components/schemas/automation_rule_triggered" />
x-tagGroups:
  - name: Events schemas
    tags:
      - events_schema
      - events_schema_product_updated
      - events_schema_automation_rule_triggered
  - name: API
    tags:
      - webhooks
paths:
  /v1/webhooks/configured-events:
    get:
      operationId: getConfiguredEvents
      summary: getConfiguredEvents
      description: Retrieve events that can trigger webhooks
      tags:
        - webhooks
      responses:
        "200":
          description: Success - configured events loaded with success. Empty array if no
            events have been configured.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EventConfigResp"
  /v1/webhooks/configs:
    get:
      operationId: getConfigs
      summary: getConfigs
      description: Search Webhook Client Configs
      tags:
        - webhooks
      parameters:
        - in: query
          name: eventName
          schema:
            type: string
          required: false
          description: Filter configurations by event Name
          example: customer_request_created
      responses:
        "200":
          description: Success - configs loaded with success. Empty array if org has
            configs.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/WebhookConfig"
        "500":
          description: Other errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
    post:
      operationId: createConfig
      summary: createConfig
      description: Create Webhook Client Config
      tags:
        - webhooks
      requestBody:
        description: Webhook config payload
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookConfig"
      responses:
        "201":
          description: Success - if the config is created successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookConfig"
        "400":
          description: Validation Errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "401":
          description: Authentication Errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "500":
          description: Other errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
  "/v1/webhooks/configs/{configId}":
    get:
      operationId: getConfig
      summary: getConfig
      description: Get webhook config by id
      tags:
        - webhooks
      parameters:
        - in: path
          name: configId
          schema:
            type: string
          required: true
          description: Short uuid to identify the webhook configuration.
          example: 7hj28aasgag2gha2
      responses:
        "200":
          description: Success - if the config is updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookConfig"
        "404":
          description: No configuration found for this id
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "500":
          description: Other errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
    put:
      operationId: updateConfig
      summary: updateConfig
      description: Update Webhook Client Config
      tags:
        - webhooks
      parameters:
        - in: path
          name: configId
          schema:
            type: string
          required: true
          description: Short uuid (length 6) to identify the webhook configuration.
          example: 7hj28a
      requestBody:
        description: Webhook config payload
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/WebhookConfig"
      responses:
        "200":
          description: Success - if the config is updated successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/WebhookConfig"
        "400":
          description: Validation Errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "401":
          description: Authentication Errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "500":
          description: Other errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
    delete:
      operationId: deleteConfig
      summary: deleteConfig
      description: Delete Webhook Client Config
      tags:
        - webhooks
      parameters:
        - in: path
          name: configId
          schema:
            type: string
          required: true
          description: Id of the config to de deleted.
          example: CustomerRequest
      responses:
        "204":
          description: Success - if the config is deleted successfully
        "401":
          description: Failed to authenticate
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "404":
          description: No config found
  /v1/webhooks/failures:
    get:
      operationId: getFailures
      summary: getFailures
      description: Get saved failures from the webhooks DB, in a paginated way
      tags:
        - webhooks
      parameters:
        - in: query
          name: lastLoadedEventId
          schema:
            type: string
          required: false
          description: Optional Key. To be provided when loading paginated data. It is
            always returned initially by this API, is pagination is needed.
          example: 1f143bd2-f816-4d7d-b33d-056db6e1ef7b
        - in: query
          name: lastLoadedTimestamp
          schema:
            type: string
          required: false
          description: Optional Key. To be provided when loading paginated data. It is
            always returned initially by this API, is pagination is needed.
          example: 2021:05:06T12:00:26.000Z
      responses:
        "200":
          description: Success - if the API call returned successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FailuresResp"
        "400":
          description: Validation Errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "401":
          description: Authentication Errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "500":
          description: Other errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
  /v1/webhooks/failures/resend:
    post:
      operationId: resendFailure
      summary: resendFailure
      description: Resend payload for one failure
      tags:
        - webhooks
      requestBody:
        description: Resend payload
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FailureEntry"
      responses:
        "204":
          description: Success - Payload has been resend
        "401":
          description: Authentication Errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
        "500":
          description: Other errors
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResp"
components:
  schemas:
    HttpMethod:
      type: string
      enum:
        - GET
        - POST
        - PUT
        - PATCH
        - DELETE
        - OPTIONS
        - HEAD
    AuthType:
      type: string
      enum:
        - BASIC
        - OAUTH_CLIENT_CREDENTIALS
        - API_KEY
    Filter:
      type: object
      properties:
        keyToFilter:
          type: string
        supportedValues:
          type: array
          items:
            type: string
      required:
        - keyToFilter
        - supportedValues
    Auth:
      type: object
      properties:
        authType:
          $ref: "#/components/schemas/AuthType"
        basicAuthConfig:
          $ref: "#/components/schemas/BasicAuthConfig"
        oauthConfig:
          $ref: "#/components/schemas/OAuthConfig"
        apiKeyConfig:
          $ref: "#/components/schemas/ApiKeyConfig"
      required:
        - authType
    BasicAuthConfig:
      type: object
      description: To be sent only if authType is BASIC
      properties:
        username:
          type: string
        password:
          type: string
      required:
        - username
    OAuthConfig:
      type: object
      description: To be sent only if authType is OAUTH_CLIENT_CREDENTIALS
      properties:
        clientId:
          type: string
        clientSecret:
          type: string
        endpoint:
          type: string
          description: Https Endpoint for authentication
        httpMethod:
          $ref: "#/components/schemas/HttpMethod"
      required:
        - clientId
        - endpoint
        - httpMethod
    ApiKeyConfig:
      type: object
      description: To be sent only if authType is API_KEY
      properties:
        keyName:
          type: string
        keyValue:
          type: string
      required:
        - keyName
    WebhookConfig:
      type: object
      properties:
        id:
          type: string
        eventName:
          type: string
        url:
          type: string
        creationTime:
          type: string
          description: creation timestamp
          example: 2021-04-27T12:01:13.000Z
        httpMethod:
          $ref: "#/components/schemas/HttpMethod"
        enabled:
          type: boolean
        auth:
          $ref: "#/components/schemas/Auth"
        filter:
          $ref: "#/components/schemas/Filter"
      required:
        - eventName
        - url
        - httpMethod
        - auth
      example:
        eventName: CustomerRequest_Created
        url: https://my-partner-service.api.com
        httpMethod: POST
        enabled: true
        auth:
          authType: BASIC
          basicAuthConfig:
            username: secretUsername
            password: secret7825@!
        filter:
          keyToFilter: customer_request.productId
          supportedValues:
            - "2324245"
            - "5253642"
    EventConfigResp:
      type: array
      items:
        $ref: "#/components/schemas/EventConfigEntry"
      example:
        - eventName: customer_request_created
          eventLabel: Customer Request Created
    EventConfigEntry:
      type: object
      properties:
        eventName:
          type: string
          description: Name for identifying the event. Unique.
        eventLabel:
          type: string
          description: Either a user friendly label, or the eventName itself.
    FailureLastKey:
      type: object
      description: Key of last loaded item previously returned via paginated response
      properties:
        orgId:
          type: string
        eventId:
          type: string
        creationTimestamp:
          type: string
    FailuresResp:
      type: object
      description: Response for get errors request.
      properties:
        lastLoadedKey:
          $ref: "#/components/schemas/FailureLastKey"
        failures:
          type: array
          items:
            $ref: "#/components/schemas/FailureEntry"
      required:
        - failures
      example:
        failures:
          - eventName: customer_request_created,
            eventId: 12e8726b-071b-4c42-9221-8caae0d14863
            errorCode: "502"
            webhookConfigId: kreauMGUr55nDoVviaaBLG
            creationTimestamp: 2021-04-13T17:43:40.576Z
            orgId: "728"
            errorPayload: Failed to store data
            url: https://63b2de56be27.ngrok.io
            payload:
              metadata:
                action: created
                creation_timestamp: 2021-04-13T17:43:40.576Z
                event_name: customer_request_created
                object: customer_request
                organization_id: "728"
                version: 1.0.0
              customer_request:
                id: TEST
                payment_details:
                  account_owner_name: Test
                  bank_name: Test Bank
                  bic: BIC
                  iban: IBAN
                  payment_method: sepa
                request_items:
                  - id: TEST
                    otherProp1: test1
                    otherProp2: test2
          - eventName: customer_request_created
            eventId: fc51a730-9730-4b55-8aa1-dd6d66b7e3e2
            errorCode: "404"
            webhookConfigId: xrExypA8HBWEtK9AXfU2de
            creationTimestamp: 2021-04-13T17:43:40.576Z
            orgId: "728"
            errorPayload: Tunnel ef68038e3af9.ngrok.io not found
            url: https://ef68038e3af9.ngrok.io
            payload:
              metadata:
                action: created
                creation_timestamp: 2021-04-13T17:43:40.576Z
                event_name: customer_request_created
                object: customer_request
                organization_id: "728"
                version: 1.0.0
              customer_request:
                id: TEST
                payment_details:
                  account_owner_name: Test
                  bank_name: Test Bank
                  bic: BIC
                  iban: IBAN
                  payment_method: sepa
                request_items:
                  - id: TEST
                    otherProp1: test1
                    otherProp2: true
        lastLoadedKey:
          orgId: 6122
          eventId: fc51a730-9730-4b55-8aa1-dd6d66b7e3e2
          creationTimestamp: 2022:01:01T00:00:00.000Z
    FailureEntry:
      type: object
      description: Failures stored in the database.
      properties:
        orgId:
          type: string
          description: The ID of the given organization
        eventId:
          type: string
          description: ID of event. Unique
        eventName:
          type: string
          description: Name for identifying the event. Unique.
        creationTimestamp:
          type: string
          description: Time of event creation
        payload:
          type: object
          description: Contains the metadata about the configured event
        webhookConfigId:
          type: string
          description: The ID of the webhook configuration
        errorCode:
          type: string
        errorPayload:
          type: string
          description: The error message encountered during webhook delivery
        url:
          type: string
          description: destination url of configured webhook
    ErrorResp:
      type: object
      properties:
        message:
          type: string
    customer_request:
      type: object
      properties:
        metadata:
          type: object
          properties:
            version:
              type: string
              example: 1.0.0
            action:
              type: string
              enum:
                - created
              example: created
            object:
              type: string
              enum:
                - customer_request
              example: customer_request
            organization_id:
              type: string
              description: Id of the organization the hook was triggered for.
              example: 1234567
            creation_timestamp:
              type: string
              description: Given as String in format of YYYY-MM-DDTHH:MM:SS.MSSZ
              example: 2021-01-01T08:15:567Z
          required:
            - version
            - action
            - object
            - organization_id
            - creation_timestamp
        customer_request:
          type: object
          properties:
            id:
              type: string
              description: Internal identifier of the checkout
            journey_name:
              type: string
              description: The name of the journey generating the payload
            request_items:
              type: array
              description: Lists all products and add-ons the customer requested.
              items:
                type: object
                properties:
                  id:
                    type: string
                    description: External customer request id (opportunity id)
                    example: EPD-1234
                  title:
                    type: string
                    description: Title of the request, if any.
                    example: Hausanschluß für Strom
                  description:
                    type: string
                    description: Some description for this specific request. Optional
                  product_id:
                    type: string
                    description: The id of the product/addon
                    example: 2345678
                  product_category:
                    type: string
                    description: Product category - gas, power, broadband, etc.
                    example: HOUSE_CONNECTION_ELECTRICITY
                  product_name:
                    type: string
                    example: Strom, Standard
                  product_type:
                    type: string
                    enum:
                      - product
                      - addon
                    example: product
                  product_description:
                    type: string
                    description: Short description of the product/add-on, if any.
                  seller:
                    type: object
                    properties:
                      id:
                        type: string
                        description: Id of the organization offering the item.
                        example: 1234567
                      name:
                        type: string
                        description: Organization name
                        example: epilot
                  selling_option:
                    type: object
                    properties:
                      name:
                        type: string
                        example: Standard
                      payment_type:
                        type: string
                        enum:
                          - one_time
                          - recurring
                        example: recurring
                      billing_frequency:
                        type: string
                        enum:
                          - monthly
                          - yearly
                        example: monthly
                      number_of_payments:
                        type: number
                        example: 12
                  pricing_components:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Reference of the price component.
                          example: XYZ00112
                        name:
                          type: string
                          example: Stromsteuer
                        net_price:
                          type: string
                          description: Value expressed in smallest currency unit, e.g. Eurocents, i.e. 12
                            Euro = "1200"
                          example: 2000
                        gross_price:
                          type: string
                          description: Value expressed in smallest currency unit, e.g. Eurocents, i.e. 12
                            Euro = "1200"
                          example: 2380
                        tax:
                          type: number
                          description: values between 0 and 1, to represent percentages. Eg- 0.19 for 19%
                            VAT.
                          example: 0.19
                        currency:
                          type: string
                          description: Represented by ISO 4217 alphabetic code, e.g. EUR, USD
                          example: EUR
                        payment_frequency:
                          type: string
                          enum:
                            - one_time
                            - monthly
                            - yearly
                          example: one_time
                        ordered_quantity:
                          type: number
                          example: 10
                        unit:
                          type: string
                          description: The base unit of a variable price component.
                          example: kWh
                  custom_package_fields:
                    type: array
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                          example: Tarifreferenz
                        value:
                          type: string
                          example: XYZ-123
                        type:
                          type: string
                  estimated_consumption:
                    type: number
                    example: 2500
                  contract_type:
                    type: string
                    enum:
                      - switching
                      - new_contract
                    example: new_contract
                  contract_date:
                    type: string
                    description: The day the requested contract will start. Given as String in full
                      format of YYYY-MM-DDTHH:MM:SS.MSSZ
                    example: 2021-02-01T00:00:0000Z
                  dates:
                    type: array
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                          description: Label of the date field as configured in customer journey, e.g.
                            installation date, contract termination.
                          example: Vertragsende
                        date:
                          type: string
                          description: Given as String in full format of YYYY-MM-DDTHH:MM:SS.MSSZ
                          example: 2021-02-01T00:00:0000Z
                  documents:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                          example: https://api.epilot.cloud/v2/opportunities/EPD-1234/attachments
                  custom_fields:
                    type: array
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                          example: Rechnungsnummer
                        value:
                          type: string
                          example: Rech123
                        type:
                          type: string
                  journey_custom_fields:
                    type: array
                    items:
                      type: object
                      properties:
                        label:
                          type: string
                          example: Rechnungsnummer
                        value:
                          type: string
                          example: Rech123
                        type:
                          type: string
                  current_energy_provider:
                    type: string
                    example: epilot
                  current_energy_provider_id:
                    type: string
                    example: "123456"
                  metering_devices:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Id of metering device
                        meter_reading:
                          type: number
                  available_for:
                    type: array
                    items:
                      type: string
                      example: 4567890
                    description: List of product ids that the addon is available for. Only for addon
                      item types.
                required:
                  - id
                  - product_id
                  - product_name
                  - product_type
                  - seller
                  - selling_option
            payment_details:
              type: object
              properties:
                payment_method:
                  type: string
                  enum:
                    - invoice
                    - sepa
                    - paypal
                  description: Invoice refers to credit transfer while sepa represents direct
                    debit.
                  example: invoice
                account_owner_name:
                  type: string
                  description: Name of the account owner.
                  example: Harvey Specter
                iban:
                  type: string
                  example: DE12500105170648489890
                bic:
                  type: string
                  example: INGBDE
                bank_name:
                  type: string
                  example: ING-DiBa
              required:
                - payment_method
            contacts:
              type: object
              properties:
                customer:
                  allOf:
                    - $ref: "#/components/schemas/customer_request/properties/customer_request/proper\
                        ties/contacts/properties/billing"
                    - type: object
                      properties:
                        consents:
                          type: object
                          properties:
                            terms_and_conditions:
                              type: object
                              properties:
                                accepted:
                                  type: boolean
                                  description: True/False - Whether this consent has been accepted by the user
                                  example: true
                                text:
                                  type: string
                                  description: Text describing the consent/policy
                                  example: Ich habe die Datenschutzbestimmungen gelesen und stimme diesen zu.
                                urls:
                                  type: array
                                  items:
                                    type: string
                                    description: Url for the policy/consent
                                    example: https://epilot.cloud/datenschutz/
                            privacy:
                              $ref: "#/components/schemas/customer_request/properties/customer_request/proper\
                                ties/contacts/properties/customer/allOf/1/prope\
                                rties/consents/properties/terms_and_conditions"
                            others:
                              type: array
                              items:
                                allOf:
                                  - $ref: "#/components/schemas/customer_request/properties/customer_request/proper\
                                      ties/contacts/properties/customer/allOf/1\
                                      /properties/consents/properties/terms_and\
                                      _conditions"
                                  - type: object
                                    properties:
                                      label:
                                        type: string
                                        description: Label for this consent. Eg - Marketing.
                                        example: advertising
                billing:
                  type: object
                  properties:
                    id:
                      type: string
                      example: 12345
                    type:
                      type: string
                      enum:
                        - private
                        - business
                      example: private
                    salutation:
                      type: string
                      enum:
                        - MR
                        - MRS
                        - MRX
                      example: MR
                    title:
                      type: string
                      description: Any titles this contact has. Eg - Prof., Dr., etc.
                      example: Prof. Dr.
                    first_name:
                      type: string
                      example: Harvey
                    last_name:
                      type: string
                      example: Specter
                    company_name:
                      type: string
                      example: epilot GmbH
                    email:
                      type: string
                      example: harvey.specter@epilot.cloud
                    phone_numbers:
                      type: array
                      items:
                        type: object
                        properties:
                          label:
                            type: string
                            description: Phone number label/category. Eg - private, mobile, etc. Default
                              value - default
                            example: Festnetz
                          phone:
                            type: string
                            description: The phone number itself.
                            example: +49 221 588 32900
                    birthday:
                      type: string
                      description: Birthday of the contact, if present. Given as String in format of
                        YYYY-MM-DD
                      example: 2020-10-10
                    address:
                      type: object
                      properties:
                        street_name:
                          type: string
                          example: Im Mediapark
                        street_number:
                          type: string
                          example: 8a
                        city:
                          type: string
                          example: Köln
                        country:
                          type: string
                          example: Deutschland
                        postal_code:
                          type: string
                          example: 50670
                        address_suffix:
                          type: string
                          example: c/o Harvey Specter
                delivery:
                  $ref: "#/components/schemas/customer_request/properties/customer_request/proper\
                    ties/contacts/properties/billing"
                additional:
                  type: array
                  items:
                    allOf:
                      - $ref: "#/components/schemas/customer_request/properties/customer_request/proper\
                          ties/contacts/properties/billing"
                      - type: object
                        properties:
                          label:
                            type: string
                            example: Leistungsempfänger
            credit_information:
              type: array
              description: List of credit checks.
              items:
                type: object
                properties:
                  credit_check_institute:
                    type: string
                    description: Credit check institute.
                    example: Schufa
                  score:
                    type: number
                    description: "credit score. "
                    example: 90
                  rulebook:
                    type: string
                    description: "Rulebook code as configured in the journey. "
                    example: EVU
                  error_message:
                    type: string
                    description: "Error message in case of any problem during credit check. "
                    example: ERROR_CODE - Some error message;
                required:
                  - credit_check_institute
          required:
            - id
            - contacts
      required:
        - metadata
    product_updated:
      type: object
      properties:
        metadata:
          properties:
            action:
              type: string
              description: ""
              example: PACKAGE_UDPATED
            organization:
              type: string
              description: Organization name
              example: Sun Solar System
            organization_id:
              type: string
              description: Organization Id
              example: Sun Solar System
            timestamp:
              format: date-time
              type: string
              description: Given as String in format of YYYY-MM-DDTHH:MM:SS.MSSZ
              example: 2021-07-13T15:57:45.399Z
            user:
              type:
                - object
                - "null"
              description: The name of the person who updated the product
              example: Admin
          required:
            - organization
            - organization_id
            - action
            - user
            - timestamp
          type: object
        customer_request:
          properties:
            request_items:
              properties:
                product_category:
                  type: string
                  description: Product type of the package
                  example: SOLAR
              required:
                - product_category
              type: object
          required:
            - request_items
          type: object
        package:
          properties:
            custom_fields:
              items:
                properties:
                  custom_field_key:
                    type: string
                    description: ""
                    example: kWp
                  custom_field_value:
                    type: string
                    description: ""
                    example: ""
                required:
                  - custom_field_key
                  - custom_field_value
                type: object
              type: array
            description:
              type: string
              example: ""
            id:
              type: number
              example: 584217
            labels:
              type:
                - object
                - "null"
            name:
              type: string
              example: BASE ON PARTNER 1
            number:
              type: string
              example: BASE ON PARTNER 1
            owner:
              type: string
              example: partner1
            product_category:
              type: string
              example: SOLAR
            selling_options:
              items:
                properties:
                  duration_number:
                    type:
                      - object
                      - "null"
                  duration_unit:
                    type:
                      - object
                      - "null"
                  name:
                    type: string
                    example: Standard123
                  payment_type:
                    type: string
                    example: ONE_TIME
                  price_component_groups:
                    type:
                      - object
                      - "null"
                  price_components:
                    items:
                      properties:
                        component_number:
                          type: string
                          example: Component from partner 2
                        component_type:
                          type: string
                          example: STATIC_COMPONENT
                        currency:
                          type: string
                          example: EURO
                        gross_purchase_price:
                          format: double
                          type: number
                          example: 234
                        gross_retail_price:
                          format: double
                          type: number
                          example: 234
                        name:
                          type: string
                          example: Component from partner 2
                        net_purchase_price:
                          format: double
                          type: number
                          example: 234
                        net_retail_price:
                          format: double
                          type: number
                          example: 234
                        payment_frequency:
                          type: string
                          example: ONE_TIME
                        pricing_type:
                          type: string
                          example: FIXED
                        purchase_tax:
                          type: number
                          example: 0
                        quantity:
                          type: number
                          example: 1
                        range:
                          properties:
                            lower_bound_toggle:
                              type: boolean
                              example: true
                            range_end:
                              type:
                                - object
                                - "null"
                            range_start:
                              type:
                                - object
                                - "null"
                            range_type:
                              type: string
                              example: NO_RANGE
                          required:
                            - range_end
                            - range_start
                            - range_type
                            - lower_bound_toggle
                          type: object
                        retail_tax:
                          type: number
                          example: 0
                      required:
                        - component_number
                        - net_purchase_price
                        - gross_retail_price
                        - quantity
                        - range
                        - retail_tax
                        - net_retail_price
                        - pricing_type
                        - component_type
                        - purchase_tax
                        - gross_purchase_price
                        - payment_frequency
                        - name
                        - currency
                      type: object
                    type: array
                  price_on_request:
                    type: boolean
                    example: "false"
                required:
                  - payment_type
                  - duration_number
                  - price_component_groups
                  - name
                  - price_on_request
                  - duration_unit
                  - price_components
                type: object
              type: array
          required:
            - owner
            - number
            - custom_fields
            - name
            - description
            - id
            - selling_options
            - product_category
            - labels
          type: object
      required:
        - metadata
        - customer_request
        - package
    automation_rule_triggered:
      type: object
      properties:
        metadata:
          properties:
            action:
              type: string
            organization_id:
              type: number
            sender:
              properties:
                id:
                  type: string
                type:
                  type: string
              required:
                - id
                - type
              type: object
            timestamp:
              format: date-time
              type: string
            v:
              type: string
            webhook_id:
              type: string
          required:
            - sender
            - webhook_id
            - v
            - organization_id
            - action
            - timestamp
          type: object
        opportunity:
          properties:
            addresses:
              properties:
                billing_address:
                  type:
                    - object
                    - "null"
                delivery_address:
                  type:
                    - object
                    - "null"
                other_addresses:
                  items:
                    type: object
                  type: array
              required:
                - delivery_address
                - billing_address
                - other_addresses
              type: object
            attachments_url:
              type: string
            creation_date:
              format: date-time
              type: string
            custom_fields:
              items:
                properties:
                  custom_field_key:
                    type: string
                  custom_field_value:
                    type:
                      - object
                      - "null"
                  product_category:
                    type: string
                required:
                  - custom_field_key
                  - custom_field_value
                  - product_category
                type: object
              type: array
            customer:
              properties:
                customer_details:
                  properties:
                    customer_number:
                      type:
                        - object
                        - "null"
                    email_addresses:
                      items:
                        properties:
                          email:
                            type: string
                          label:
                            type: string
                        required:
                          - label
                          - email
                        type: object
                      type: array
                    first_name:
                      type: string
                    id:
                      type: number
                    last_name:
                      type: string
                    notes:
                      type:
                        - object
                        - "null"
                    phone_numbers:
                      items:
                        properties:
                          label:
                            type: string
                          number:
                            type:
                              - object
                              - "null"
                        required:
                          - number
                          - label
                        type: object
                      type: array
                    salutation:
                      type: string
                  required:
                    - email_addresses
                    - phone_numbers
                    - notes
                    - customer_number
                    - last_name
                    - id
                    - salutation
                    - first_name
                  type: object
                type:
                  type: string
              required:
                - customer_details
                - type
              type: object
            dates:
              items:
                properties:
                  date:
                    type:
                      - object
                      - "null"
                  label:
                    type: string
                  product_category:
                    type: string
                required:
                  - date
                  - label
                  - product_category
                type: object
              type: array
            description:
              type: string
            last_update:
              format: date-time
              type: string
            opportunity_id:
              type: string
            pricing_items:
              properties:
                add_ons:
                  items:
                    type: object
                  type: array
                individual_adjustments:
                  items:
                    type: object
                  type: array
                packages:
                  items:
                    properties:
                      add_ons:
                        items:
                          type: object
                        type: array
                      contract_end_date:
                        type:
                          - object
                          - "null"
                      contract_start_date:
                        type:
                          - object
                          - "null"
                      custom_fields:
                        items:
                          properties:
                            custom_field_key:
                              type: string
                            custom_field_value:
                              type: string
                          required:
                            - custom_field_key
                            - custom_field_value
                          type: object
                        type: array
                      id:
                        type: number
                      individual_adjustments:
                        items:
                          type: object
                        type: array
                      name:
                        type: string
                      owner:
                        type: string
                      price_components:
                        items:
                          properties:
                            component_number:
                              type: string
                            currency:
                              type: string
                            gross_retail_price:
                              format: double
                              type: number
                            gross_retail_price_total:
                              format: double
                              type: number
                            name:
                              type: string
                            net_retail_price:
                              format: double
                              type: number
                            payment_frequency:
                              type: string
                            quantity:
                              format: double
                              type: number
                            status:
                              type: string
                            tax:
                              format: double
                              type: number
                          required:
                            - component_number
                            - gross_retail_price
                            - quantity
                            - gross_retail_price_total
                            - payment_frequency
                            - name
                            - currency
                            - tax
                            - net_retail_price
                            - status
                          type: object
                        type: array
                      price_variables:
                        items:
                          properties:
                            unit:
                              type: string
                            value:
                              type: string
                          required:
                            - unit
                            - value
                          type: object
                        type: array
                      product_category:
                        type: string
                      product_type:
                        type: string
                      selling_option:
                        properties:
                          duration_number:
                            type: number
                          duration_unit:
                            type:
                              - object
                              - "null"
                          name:
                            type: string
                          payment_type:
                            type: string
                        required:
                          - payment_type
                          - duration_number
                          - name
                          - duration_unit
                        type: object
                    required:
                      - owner
                      - price_variables
                      - custom_fields
                      - contract_start_date
                      - contract_end_date
                      - product_type
                      - name
                      - add_ons
                      - id
                      - individual_adjustments
                      - price_components
                      - product_category
                      - selling_option
                    type: object
                  type: array
              required:
                - add_ons
                - individual_adjustments
                - packages
              type: object
            source:
              type:
                - object
                - "null"
            title:
              type: string
          required:
            - addresses
            - attachments_url
            - opportunity_id
            - custom_fields
            - pricing_items
            - last_update
            - description
            - dates
            - creation_date
            - source
            - title
            - customer
          type: object
      required:
        - metadata
        - opportunity
  securitySchemes:
    EpilotAuth:
      type: http
      scheme: bearer
      description: Authorization header with epilot OAuth2 bearer token
      bearerFormat: JWT
security:
  - EpilotAuth: []
servers:
  - url: https://webhooks.sls.epilot.io
