npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@digigov-oss/govcrm-rest-client

v1.0.0

Published

GovCRM REST API Client for Greek Ministry of Digital Governance

Downloads

95

Readme

GovCRM REST API Client

TypeScript/JavaScript client library for accessing the Greek Government CRM (GovCRM) REST API through the Ministry of Digital Governance Interoperability Center (KED).

Overview

This package provides a client for interacting with the GovCRM REST API, which manages citizen service cases and government procedures in Greece. The API is provided by the Interoperability Center of the Greek Ministry of Digital Governance.

Features

  • TypeScript Support: Full type definitions for all API operations
  • Rate Limiting: Built-in request rate limiting using Bottleneck
  • Authentication: Basic Authentication support
  • Error Handling: Comprehensive error handling with Greek and English error messages
  • Environment Support: Separate pilot and production environment URLs
  • Helper Methods: Utility functions for audit records, date formatting, and validation

Installation

npm install @digigov-oss/govcrm-rest-client

Quick Start

import {
    HttpGovCrmClient,
    StatusCode,
    ExternalSystemType,
    CustomerKeyType,
} from '@digigov-oss/govcrm-rest-client';
import axios from 'axios';

// Create HTTP reader using axios
const axiosReader = {
    get: async (url, config) => axios.get(url, config).then((r) => r.data),
    post: async (url, config) =>
        axios.post(url, config?.data, { headers: config?.headers }).then((r) => r.data),
};

// Initialize client
const client = new HttpGovCrmClient(axiosReader, {
    apiUrl: 'https://test.gsis.gr/esbpilot/govcrmRestService', // Pilot environment
    username: 'your-username',
    password: 'your-password',
});

// Update a case
const updateResponse = await client.updateCase({
    auditRecord: HttpGovCrmClient.createAuditRecordSync('1', 'MyOrg', 'PROT001'),
    govcrmCaseUpdateInputRecord: {
        govcrmSectorcode: '66797',
        govcrmExternalsystem: ExternalSystemType.EKEP,
        govcrmExternalticketnumber: 'CASE-123',
        govcrmStatusdetails: 'Case completed successfully',
        statuscode: StatusCode.SUCCESSFUL_COMPLETION,
        govcrmResponsereceivedon: HttpGovCrmClient.formatDate(new Date()),
        govcrmCustomerkey: CustomerKeyType.CITIZEN_CODE,
        govcrmCustomercode: '1234567',
    },
});

// Create a new case
const createResponse = await client.createCase({
    auditRecord: HttpGovCrmClient.createAuditRecordSync('2', 'MyOrg', 'PROT002'),
    govcrmCaseCreateInputRecord: {
        govcrmSectorcode: '93742',
        govcrmKepcode: '123',
        govcrmKeptype: KepType.EDYTE,
        govcrmExternalsystem: ExternalSystemType.EKEP,
        govcrmExternalticketnumber: 'INTEGRATION-TEST-CREATE',
        govcrmCasetype: '746646', // EMD code
        govcrmCasename: 'Integration Test Case Creation',
        govcrmStatus: CaseStatus.INITIAL_CREATION,
        govcrmStatusdetails: 'Integration test case creation',
        govcrmAgentcomments: 'No comments',
        govcrmCustomerkey: CustomerKeyType.AFM,
        govcrmCustomercode: '154683952',
    },
});

API Methods

Case Update (updateCase)

Updates the status of an existing case in the CRM system.

Parameters:

  • govcrmSectorcode: Organization code (required)
  • govcrmExternalticketnumber: External ticket number to update (required)
  • statuscode: Completion status code (required)
  • govcrmStatusdetails: Status description
  • govcrmResponsereceivedon: Completion date
  • govcrmCustomerkey/govcrmCustomercode: Citizen identification

Response:

  • Success: responseMessage with confirmation
  • Error: code and message with error details

Case Create (createCase)

Creates a new case in the CRM system for existing procedures.

Parameters:

  • govcrmSectorcode: Organization VAT (required)
  • govcrmCasetype: Procedure identifier (MITOS code)
  • govcrmCasename: Case title
  • govcrmStatus: Request status
  • govcrmCustomerkey/govcrmCustomercode: Citizen identification
  • govcrmMetadata: Optional JSON metadata

Response:

  • Success: responseMessage with "204"
  • Error: code and message with error details

Enums and Types

Status Codes

enum StatusCode {
    SUCCESSFUL_COMPLETION = 1,
    MANUAL_CANCELLATION = 2,
    REQUEST_REJECTION = 3,
    TECHNICAL_PROBLEM = 4,
    REQUEST_SUBMISSION = 5,
}

Customer Key Types

enum CustomerKeyType {
    AFM = 'AFM', // Tax Registration Number
    AMKA = 'AMKA', // Social Security Number
    PA = 'PA', // Personal Number
    CITIZEN_CODE = 'CITIZEN_CODE',
    ID = 'ID', // Identity Card Number
    HASH_PA = 'HASH_PA', // Anonymized Personal Number
}

External Systems

enum ExternalSystemType {
    GOV_GR = 'gov.gr',
    EKEP = 'eKEP',
}

Helper Methods

Create Audit Record

The client integrates with the official @digigov-oss/gsis-audit-record-db package for audit record management:

// Using the official audit record package (recommended)
const auditRecord = await HttpGovCrmClient.createAuditRecord({
    auditTransactionId: 'TRANS001',
    auditUnit: 'MyOrganization',
    auditProtocol: 'PROT123',
    auditUserId: 'user1',
    auditUserIp: '192.168.1.1',
});

// Or use the synchronous helper for backward compatibility
const auditRecord = HttpGovCrmClient.createAuditRecordSync(
    'TRANS001', // Transaction ID
    'MyOrganization', // Unit name
    'PROT123', // Protocol number
    'user1', // Optional: User ID
    '192.168.1.1', // Optional: User IP
);

Date Formatting

const formattedDate = HttpGovCrmClient.formatDate(new Date()); // Returns YYYY-MM-DD
const isValid = HttpGovCrmClient.isValidDateFormat('2024-12-16'); // Returns boolean

Environment URLs

const pilotUrl = HttpGovCrmClient.getPilotUrl(); // Test environment
const prodUrl = HttpGovCrmClient.getProductionUrl(); // Production environment

Error Handling

The client provides comprehensive error handling with specific error codes:

try {
    const response = await client.updateCase(request);

    if (response.govcrmCaseUpdateOutputRecord.responseMessage) {
        // Success
        console.log('Case updated successfully');
    } else {
        // Business logic error
        console.error('Error:', response.govcrmCaseUpdateOutputRecord.message);
    }
} catch (error) {
    // Network or authentication error
    console.error('API Error:', error);
}

Authentication

The client uses Basic Authentication. Credentials are automatically encoded and included in request headers:

const client = new HttpGovCrmClient(httpReader, {
    username: 'your-username',
    password: 'your-password',
    // Other options...
});

Development

# Install dependencies
npm install

# Build the project
npm run build


# Format code
npm run format

# Lint code
npm run lint