The Data connector feature in Lehjah allows you to seamlessly integrate and pull data from your platform into Lehjah by configuring headers, queries, request URLs, and mapping response data. This page will guide you through setting up data connectors for various data types, ensuring that your platform communicates effectively with Lehjah.

Configuration Overview

When setting up a data connector, you’ll need to define the following components:

1

Headers

Key-value pairs that are included in the request, often used for authentication.

2

Query Parameters

URL parameters that customize the request (e.g., filtering, pagination).

3

Body

Optional data payload to send with the request (for POST/PUT requests).

4

Request URL

The endpoint where the data will be fetched from.

5

Response Mapping

Mapping the response data from your platform to the corresponding fields in Lehjah.

Data Types and Request Samples

Lehjah supports various data types that can be pulled from your platform. Below are the available data types and their configuration requirements:

1. Business Profile

This data type pulls the business profile information from your platform.

Business profile data connection is mandatory for the widget embedding to work. As the user (i.e business) will be authorized based on your platform authorization token.
curl -X GET "https://api.yourplatform.com/businesses/{{businessId}}/profile" \
  -H "Authorization: Bearer {{sessionToken}}"
Business profile mapping keys
  [
      {
          label: 'Business name',
          value: 'business_name',
          required: true
      },
      {
          label: 'Phone number',
          value: 'phone',
          required: true
      },
      {
          label: 'Email address',
          value: 'email',
          required: true
      },
      {
          label: 'Country',
          value: 'country',
          required: true
      },
      {
          label: 'Currency',
          value: 'currency',
          required: true
      }
  ]

2. Wallets

This data type retrieves all wallets associated with a business.

curl -X GET "https://api.yourplatform.com/businesses/{{businessId}}/wallets" \
  -H "Authorization: Bearer {{sessionToken}}"
Wallet mapping keys
[
  {
    label: 'ID',
    value: 'id',
    required: true
  },
  {
    label: 'Name',
    value: 'name',
    required: true
  },
  {
    label: 'Currency',
    value: 'currency',
    required: true
  }
]

3. Invoices

This data type fetches invoices from your platform.

curl -X GET "https://api.yourplatform.com/businesses/{{businessId}}/invoices?from={{fromDate}}&to={{toDate}}&limit={{pageLimit}}&page={{pageNumber}}" \
  -H "Authorization: Bearer {{sessionToken}}"

4. Bills

This data type retrieves bills for the business.

curl -X GET "https://api.yourplatform.com/businesses/{{businessId}}/bills?from={{fromDate}}&to={{toDate}}&limit={{pageLimit}}&page={{pageNumber}}" \
  -H "Authorization: Bearer {{sessionToken}}"

5. Transactions (Bank or Wallet)

This data type pulls bank transactions that correspond to payments.

curl -X GET "https://api.yourplatform.com/businesses/{{businessId}}/transactions?from={{fromDate}}&to={{toDate}}&limit={{pageLimit}}&page={{pageNumber}}" \
  -H "Authorization: Bearer {{sessionToken}}"
Transaction keys
  [
      {
          label: 'Business name',
          value: 'business_name',
          required: true
      },
      {
          label: 'Phone number',
          value: 'phone',
          required: true
      },
      {
          label: 'Email address',
          value: 'email',
          required: true
      },
      {
          label: 'Country',
          value: 'country',
          required: true
      },
      {
          label: 'Currency',
          value: 'currency',
          required: true
      }
  ]

6. Inventory Items

This data type retrieves inventory items from your platform.

curl -X GET "https://api.yourplatform.com/businesses/{{businessId}}/inventory?limit={{pageLimit}}&page={{pageNumber}}" \
  -H "Authorization: Bearer {{sessionToken}}"
Inventory item keys
  [
     
      {
          label: 'Name',
          value: 'name',
          required: true
      },
      {
          label: 'Description',
          value: 'description',
          required: false
      },
      {
          label: 'SKU',
          value: 'sku',
          required: false
      },
      {
          label: 'Cost price',
          value: 'cost_price',
          required: true
      },
      {
          label: 'Selling price',
          value: 'default_sales_price',
          required: true
      },
      {
          label: 'Unit',
          value: 'unit',
          required: true
      }

  ]

7. Restock Records

This data type pulls restock records for inventory items.

curl -X GET "https://api.yourplatform.com/businesses/{{businessId}}/restocks?from={{fromDate}}&to={{toDate}}&limit={{pageLimit}}&page={{pageNumber}}" \
  -H "Authorization: Bearer {{sessionToken}}"

Testing Your Configuration

Once you’ve set up the data connectors, use the default variable values provided in the No-Code Administrator to test your configuration. Ensure that the response data is correctly mapped to Lehjah’s expected fields for a seamless integration.

By accurately configuring these data connectors, you enable Lehjah to pull essential business data from your platform, providing a complete and integrated accounting experience.