> ## Documentation Index
> Fetch the complete documentation index at: https://ekacare-fix-ts-sdk-github-npm-links.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# EkaCare Webhook SDK

> SDK for processing EkaCare webhook events

# Overview

[EkaCare Webhook SDK on GitHub](https://github.com/eka-care/ekapython-webhook-sdk)

The EkaCare Webhook SDK enables secure processing of webhook events from EkaCare. It validates webhook signatures, manages sensitive data, and ensures only authorized requests are processed.

Deployment is automated using the [deploy.sh](https://github.com/eka-care/ekapython-webhook-sdk/blob/main/deploy.sh) script, which performs the following steps:

* Creates an ECR repository, builds the Docker image using the Dockerfile, and pushes it to ECR.
* Uses AWS CloudFormation to provision all required resources, including:
* A Lambda function (using the Docker image) with a new IAM role.
* VPC attachment for the Lambda function.
* A REST API Gateway for the Lambda, with a custom domain name (as specified in `config.env`).
* A Route 53 DNS entry pointing to the API Gateway for the custom domain.
* Registers the webhook endpoint with EkaCare using the provided URL.

This setup ensures a secure, scalable, and automated deployment of the webhook handler in your AWS environment.

***

## Environment Variables

Set the following environment variables for proper application functionality:

### Mandatory Variables

* `CLIENT_ID`: Your client ID for authentication (**required**)
* `CLIENT_SECRET`: Your client secret for authentication (**required**)

### Conditional Variables

`SIGNING_KEY`:

* Required when `IS_SIGNING_KEY_IMPLEMENTED` is set to `True` in `constants.py`
* Used for verifying webhook signatures

`API_KEY`:

* Required for business use cases
* Used for making authorized API calls to EkaCare services

***

## Configuration

To disable signature verification, set `IS_SIGNING_KEY_IMPLEMENTED = False` in the `constants.py` file.

Ensure all required environment variables are set before deploying or running the application.

### Example: `constants.py`

Sample: [https://github.com/eka-care/ekapython-webhook-sdk/blob/main/constants.py](https://github.com/eka-care/ekapython-webhook-sdk/blob/main/constants.py)

```python theme={null}
import os

# Set to True to enable signature verification (recommended for production)
IS_SIGNING_KEY_IMPLEMENTED = True

# Provide signing key here
SIGNING_KEY = os.getenv("SIGNING_KEY")

# Client ID (Mandatory)
CLIENT_ID = os.getenv("CLIENT_ID")

# Client Secret (Mandatory)
CLIENT_SECRET = os.getenv("CLIENT_SECRET")

# API Key (Optional, required for business use cases)
API_KEY = os.getenv("API_KEY")
```

## Signature Verification

* Set `IS_SIGNING_KEY_IMPLEMENTED` in `constants.py`:
* `True`: Enable signature verification (**recommended for production**)
* `False`: Disable signature verification (**use only for testing**)

***

## How to Deploy eka-webhook Python Lambda in an AWS Environment

Repository: [https://github.com/eka-care/ekapython-webhook-sdk](https://github.com/eka-care/ekapython-webhook-sdk)

### Prerequisites

* AWS CLI installed and configured
* `curl` and `unzip` installed
* Docker installed and running
* AWS credentials and permissions for deploying resources (API Gateway, CloudFormation, Lambda, ECR, etc.)

### Resources Created

* ECR repository
* Lambda function (Docker image)
* API Gateway
* Custom domain name
* Route 53 entry
* IAM role
* Security group (optional)

### Step-by-Step Setup

1. **Fork and Clone the Project**

```bash theme={null}
git clone https://github.com/eka-care/ekapython-webhook-sdk.git
```

2. **Configure AWS Credentials**

```bash theme={null}
aws configure
```

Or `export your AWS credentials` if using IAM Identity Center.

3. **Configure Environment Variables**
   Edit the `config.env` file with the necessary configuration values.

Sample: [https://github.com/eka-care/ekapython-webhook-sdk/blob/main/config.env](https://github.com/eka-care/ekapython-webhook-sdk/blob/main/config.env)

```bash theme={null}
vim config.env
```

For more details, refer to [detailed.md](https://github.com/eka-care/ekapython-webhook-sdk/blob/main/detailed.md).

4. **Make the Deployment Script Executable**

```bash theme={null}
chmod +x deploy.sh
```

## Deployment Commands

**Deploy:**

```bash theme={null}
  ./deploy.sh deploy --version <version-tag>
```

**Delete:**

```bash theme={null}
    ./deploy.sh delete
```

**Upgrade:**

```bash theme={null}
  ./deploy.sh update --version <version-tag>
```

**Help:**

```bash theme={null}
  ./deploy.sh help
```
