Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d3eae3b
updated the readme file
priyankadvekacare Nov 11, 2025
9ef5e0f
Added the whitelist domain of bucket (#427)
durgeshateka Nov 13, 2025
ecb000e
updated documentation with configurable org icons (#428)
nishantmourya-eka Nov 13, 2025
a98ae8f
changed desc text for urls in abha doc (#429)
nishantmourya-eka Nov 14, 2025
23f64ef
push (#430)
Samudranil31 Nov 19, 2025
d5f0724
update doc for cc link (#431)
shyamvlmna Nov 19, 2025
dc9f5c5
status codes (#433)
Samudranil31 Nov 20, 2025
6abb9bf
get hip users api (#434)
nadeem-ekacare Nov 24, 2025
a8972f9
abha search (#437)
shyamvlmna Nov 26, 2025
cc28033
Feature/abd 9 (#438)
shyamvlmna Nov 26, 2025
52628f1
Feature/abd 9 (#439)
shyamvlmna Nov 26, 2025
41c9ef9
Sachin/webhook documentation (#435)
sachinjaiswal-eka Nov 26, 2025
f27d236
Added the output_language in documentation (#440)
durgeshateka Nov 28, 2025
48a386d
Durgesh/output language (#441)
durgeshateka Nov 28, 2025
e84880e
[MED-14] Update MR upload documentation to state tags are treated as …
neelimasingh849 Dec 2, 2025
f8fbe6a
No-Show Appointment api added
Samudranil31 Dec 3, 2025
64820cc
No-Show Appointment (#443)
Samudranil31 Dec 3, 2025
52c466c
push (#444)
Samudranil31 Dec 3, 2025
de15236
payload change in no show api (#445)
Samudranil31 Dec 4, 2025
7d713d9
fhir-structure docs added (#446)
durgeshateka Dec 4, 2025
aa90258
medication request added (#447)
durgeshateka Dec 8, 2025
862cddc
Durgesh/medicationrequest add (#448)
durgeshateka Dec 8, 2025
16ac7b3
added type field for the mcert webhook (#449)
sachinjaiswal-eka Dec 10, 2025
113a351
Response added Create (#450)
rohit19872 Dec 11, 2025
72cb594
updated ekascribe TS SDK docs (#451)
Sanikagoyal Dec 11, 2025
1ec6e95
Added the resources in fhir structure (#453)
durgeshateka Dec 17, 2025
bb6c0d9
Added the system requirements in ekascribe (#454)
durgeshateka Dec 17, 2025
4d8b5ae
Durgesh/system req (#455)
durgeshateka Dec 17, 2025
63b839e
Eka Care MCP documentation with integration steps (#456)
mayank-garg-eka Dec 18, 2025
ecb39b2
removed getTemplateOutput method (#457)
Sanikagoyal Dec 19, 2025
911ebe6
fixed documentation and added console
vikalp Dec 22, 2025
c363dec
Abha sdk doc update (#458)
nishantmourya-eka Dec 24, 2025
9e555bc
changes regarding main doc tab
priyankadvekacare Jan 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
git .DS_Store
.idea/
.venv
.venv/*
node_modules
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview th
npm i -g mintlify
```

Run the following command at the root of your documentation (where mint.json is)
Run the following command at the root of your documentation ( where mint.json is )

```
mintlify dev
Expand Down
351 changes: 351 additions & 0 deletions SDKs/web-sdk/abha-sdk/abha-consent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,351 @@
---
title: ABHA Consent Management
description: "Complete implementation guide for the ABHA SDK to be used for ABHA Consent Management Flow."
---


# ABHA SDK - Consent Management Implementation

This guide provides everything you need to integrate the ABHA SDK into your application for ABHA Consent Management.
- **ABHA Consent Management**: Manage Consent requests raised by healthcare providers to share medical records securely.

### Implementation Example

Add the following HTML and script tags to your webpage:

```html
<!DOCTYPE html>
<html>
<head>
<title>ABHA SDK Integration for ABHA Consent Management</title>

<!-- Include ABHA SDK CSS -->
<link
rel="stylesheet"
href="https://unpkg.com/@eka-care/abha/dist/sdk/abha/css/abha.css"
/>
</head>
<body>
<h1>ABHA SDK Demo</h1>

<!-- Mount Button -->
<button class="button" onclick="mountABHASDK()">Mount SDK</button>

<!-- Container for ABHA SDK -->
<div id="sdk_container"></div>

<!-- Include ABHA SDK JS -->
<script
type="module"
src="https://unpkg.com/@eka-care/abha/dist/sdk/abha/js/abha.js"
></script>

<script>
function mountABHASDK() {
window.initAbhaApp({
containerId: "sdk_container",
clientId: 'ext',

// Pass the data here:
data: {
identifier:'abc@abdm', // Pass the phr address as identifier to get it kyc verified
identifier_type:"phr_address", // Pass the identifier type i.e. "phr_address"
consent_id: '<consent_id_of_the_consent_raised>' // Pass the consent if of the consent request raised by the healthcare provider
flow:'consent', // Pass the flow as consent
orgIcon: "<url_of_your_org_icon>", // Pass the url to your organisation icon which starts with for ex: https://cdn.eka.care/vagus/cl56w6zg3001f0scsaqrh16is.jpg
linkToOrgIcon: "<url_of_image_to_link_abha_to_your_org>", // Pass the url of an image which depicts linking abha to your organisation for ex https://cdn.eka.c
},

//Consent Successs callback
onConsentSuccess: (params) => {
console.log("ABHA Consent flow completed successfully:", params);

// Example: Store ABHA data in your app
if (window.EkaAbha) {
window.EkaAbha.onAbhaConsentSuccess(JSON.stringify(params));
}
},

// Error callback
onError: (params) => {
console.error("ABHA SDK failed:", params);

// Example: Store ABHA data in your app
if (window.EkaAbha) {
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
}
},

// Abha Close callback
onAbhaClose: () => {
console.log("ABHA SDK closed");
},
});
}
</script>
</body>
</html>
```
## Core Functions

### 1. initAbhaApp

Initializes and renders the ABHA SDK in your specified container.

**Parameters:**

| Name | Type | Required | Description |
| ------------- | --------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `containerId` | `string` | ✅ | The HTML element ID where the SDK will mount. |
| `clientId` | `string` | ✅ | Provide clientId as `ext`. |
| `data` | `{`<br/>`identifier: string;`<br/>`identifier_type: string;`<br/>`consent_id: string;`<br/>`flow: string;`<br/>`orgIcon?: string;`<br/>`linkToOrgIcon?: string;`<br/>`}` | ⚙️ Optional | Configuration data for initializing the ABHA flow. <br/>- <strong>identifier:</strong> Pass the identifier value i.e. phr address to get it kyced.<br/>- <strong>identifier_type:</strong> Pass the type of identifier which you passed in `identifier` key i.e. "phr_address". <br/>- <strong>consent_id:</strong> Pass the consent_id of the consent request raised. <br/>- <strong>flow:</strong> Pass the type of flow for which you want to use SDK for i.e. `consent` for Consent flow. <br/>- <strong>orgIcon:</strong> Public CDN URL of your organisation's icon to display inside the SDK url should start with https://. [Example](https://cdn.eka.care/vagus/cl56w6zg3001f0scsaqrh16is.jpg) <br/>- <strong>linkToOrgIcon:</strong> Public CDN URL of the icon representing “Link ABHA to your organisation” url should start with https://. [Example](https://cdn.eka.care/vagus/cm6agrs5000090tfwfz984x5b.webp) <br/> <br/> `keys with ? are optional.` |
| `onConsentSuccess` | `(params: TOnAbhaConsentSuccessParams) => void` | ✅ | Triggered when the consent flow completes successfully.
| `onError` | `(params: TOnAbhaFailureParams) => void` | ✅ | Triggered when an error occurs during the ABHA flow.
| `onAbhaClose` | `() => void` | ✅ | Triggered when SDK closes. |

**Example:**

```javascript
window.initAbhaApp({
containerId: "sdk_container",
data: {
accessToken: "your_access_token_here",
identifier: "phr_address_of_the_patient"
identifier_type: "phr_address"
consent_id: "id_of_the_consent_raised_by_healthcare_provider"
flow: "consent"
orgIcon: "url_of_your_org_icon",
linkToOrgIcon: "url_of_image_to_link_abha_to_your_org",
},
onConsentSuccess: (params) => {
console.log("ABHA consent flow completed successfully!", params);
},
onError: (error) => {
console.error("ABHA flow failed:", error);
},
onAbhaClose: (error) => {
console.error("ABHA SDK closed");
},
});
```

## Callback Parameters


### onConsentSuccess Callback

The onConsentSuccess callback is triggered when the ABHA Consent flow completes successfully.
It returns a confirmation message indicating that the Consent flow ended successfully.

**Callback Signature:**

```typescript
onConsentSuccess: (params: TOnAbhaConsentSuccessParams) => void;
```

**Type Definitions**

```typescript
type TOnAbhaConsentSuccessParams = string;
```

**Parameters**
| | Type | Description |
| ---------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
| `TOnAbhaConsentSuccessParams` | `string` | A confirmation message from SDK post Consent flow completion |



**Example:**

```javascript
const onConsentSuccess = (params) => {
console.log("Consent Flow completed:", params);

alert("Consent flow completed successfully!");

// Optionally pass data to native bridge if available
if (window.EkaAbha) {
window.EkaAbha.onAbhaConsentSuccess(params);
}
};
```

### onError Callback
The onError callback is triggered whenever an ABHA flow fails or is interrupted.
It provides details about the failure through structured parameters, allowing you to handle or forward the error appropriately (for example, to native apps or monitoring tools).

**Callback Signature:**

```typescript
onError: (params: TOnAbhaFailureParams) => void;
```

**Type Definitions**

```typescript
type TOnAbhaFailureParams = {
error?: string;
response?: TAuthVerifyV2Response;
};

type TAuthVerifyV2Response = {
skip_state: number;
method: AUTH_METHOD;
data?: {
tokens: {
sess: string;
refresh: string;
};
profile: TProfileRecord;
};
txn_id: string;
error?: {
code: number;
message: string;
};
};

enum AUTH_METHOD {
EMAIL = 1,
MOBILE = 2,
ABHA = 7,
}

type TProfileRecord = {
fln: string;
fn: string;
mn?: string;
ln?: string;
gen?: "M" | "F" | "O" | "U" | undefined; // 'male' | 'female' | 'other' | 'unknown'
dob?: string;
mobile?: string;
email?: string;
uuid?: string;
bloodgroup?: "" | "A+" | "A-" | "B+" | "B-" | "O+" | "O-" | "AB+" | "AB-";
pic?: string;
as?: string;
"dob-valid"?: boolean;
"is-d"?: boolean;
"is-d-s"?: boolean;
"is-p"?: boolean;
oid: string;
at: string;
type?: 1 | 2 | 3 | 4 | 5 | 6;
"health-ids"?: Array<string>;
abha_number?: string;
kyc_verified?: boolean;
};

```

**Parameters**
| Key | Type | Description |
| ---------- | ------------------------ | ---------------------------------------------------------------- |
| `error` | `string?` | Short description of the failure or error message. |
| `response` | `TAuthVerifyV2Response?` | Partial or full API response object returned from ABHA services. |


**Example:**

```javascript
const onError = (params) => {
console.error("ABHA Error:", params);

if (params.response?.error?.code === 1001) {
alert("Authentication failed. Please try again.");
} else if (params.error === "NETWORK_ERROR") {
alert("Please check your internet connection.");
} else {
alert("Something went wrong. Please retry.");
}

// Forward the error to native handler if available
if (window.EkaAbha) {
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
}
};
```

### onAbhaClose Callback

The onAbhaClose callback is triggered when the ABHA SDK flow gets closed.

**Callback Signature:**

```typescript
onAbhaClose: () => void;
```

**Example:**

```javascript
const onAbhaClose = () => {
console.log("ABHA SDK Closed");
};
```

**Suggest Handling**
-Always log the full error response (params) for debugging.
-Display friendly error messages for known error.code values.
-If params.response is present, inspect response.error.message for more detail.
-If integrating with native apps, forward the serialized error object:
```javascript
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
```

**Suggest Handling**
-Always log the full error response (params) for debugging.
-Display friendly error messages for known error.code values.
-If params.response is present, inspect response.error.message for more detail.
-If integrating with native apps, forward the serialized error object:
```javascript
window.EkaAbha.onAbhaFailure(JSON.stringify(params));
```

## Container Styling
Ensure your container has sufficient space:
```html
<div
id="sdk_container"
style="width: 100%; height: 600px; border: 1px solid #ddd;"
></div>
```

## Troubleshooting

### Common Issues

#### 1. SDK Not Rendering

**Problem**: Nothing appears in the container.

**Solution**:
- Ensure containerId matches an existing HTML element.
- Verify the SDK JS and CSS are correctly loaded.
- Check browser console for errors.

#### 2. APIs Not Being Called

**Problem**: API requests are not triggered after the SDK is mounted.

**Solution**:
- Ensure that the accessToken is passed correctly (do not include the Bearer prefix) and that the token has not expired.
- To prevent CORS-related issues, ensure that your domain is whitelisted.

#### 3. Callback Not Triggered

**Problem**: onSuccess, onError, onKYCSuccess, onConsentSuccess, onAbhaClose isn’t firing.

**Solution**:
- Make sure callbacks are passed as valid functions.
- Avoid race conditions (e.g., calling before SDK fully loads).

#### 4. Styling Issues

**Problem**: SDK content appears misaligned or clipped.

**Solution**:
- Give your container a fixed height (e.g., 600px).
- Ensure no parent element uses overflow: hidden.

Loading