GithubHelp home page GithubHelp logo

bhsz / nakvaksin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nubpro/nakvaksin

0.0 0.0 0.0 1.66 MB

NakVaksin helps to monitor your vaccination appointment and keep you updated whenever there is any update. You can even let your family members or co-workers to know about it too

Home Page: http://nakvaksin.com

License: GNU General Public License v3.0

JavaScript 2.88% CSS 0.13% TypeScript 96.88% Shell 0.11%

nakvaksin's Introduction


NakVaksin

A simple, easier way to get notified on your appointment.

View the App · Report Bug · Request Feature · Backend Repo

About The Project

As some MySejahtera user do not receive any notification and missed their appointment, or user are forced to check the application every day for the very same reason.
This application will provide a simple, easier way to get notified on user's vaccination appointment.

Built With

Getting Started

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • npm
  • yarn
  • node.js
npm install yarn@latest -g

Installation

  1. Clone the repo
git clone https://github.com/nubpro/nakvaksin.git
  1. Install NPM packages
yarn install

Usage

After that, simply run below command to start up the development server

yarn dev

Open http://localhost:3000 with your browser to see the result.

API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js.

The pages/api directory is map to /api/*. Files in this directory is treat as API routes instead of React pages.

Technical Explanation

How MySejahtera Authentication Works

A. Token Authentication Method

  1. Login to MySejahtera API

  2. A token is returned (x-auth-token from response header)

  3. This token expires within 3 days

  4. Pass the token when making MySejahtera API request. In the response header, a new x-auth-token is returned.

  5. Save that token on the client to ensure token validity.

B. Login with Basic Auth

To be documented soon, not something we may need to know?

MySejahtera API

1. Login

Request:

curl --location --request POST 'https://mysejahtera.malaysia.gov.my/epms/login' \
--header 'Content-Type: multipart/form-data;boundary=31' \
--header 'Host: mysejahtera.malaysia.gov.my' \
--form 'username="60123456789"' \
--form 'password="<INSERT YOUR PASSWORD>"'

Response:

  • X-AUTH-TOKEN in header

2. Get user profile

Request:

curl --location --request GET 'https://mysejahtera.malaysia.gov.my/epms/v1/mobileApp/vaccinationEmployeeInfo' \
--header 'x-auth-token: <INSERT YOUR X-AUTH-TOKEN>'

Response:

  • X-AUTH-TOKEN in header
View body returned
{
    "employeeInfo": {
        "employeeId": "F36D245FB41354E17DC2C8816FD18AFA892XXXXXXX",
        "displayName": "<YOUR FULL NAME>",
        "imageUrl": null,
        "employeeCode": "60123456789",
        "email": null,
        "userName": "60123456789",
        "designation": "Low Risk No Symptom",
        "designationCode": "LOW_RISK_NS",
        "organizationName": "Selangor",
        "localeName": "en_US",
        "primarySupervisor": {
            "id": "F36D245FB41354E17DC2C8816FXXXXXXXX",
            "empCode": "EMP1",
            "displayName": "CPRC KKM",
            "imageUrl": "https://mysejahtera.malaysia.gov.my/epms/noAuth/image/27/EMPLOYEE_IMAGE/267_27_bc104428-84df-41c8-xxxx.jpg",
            "email": "[email protected]",
            "userName": "[email protected]"
        },
        "secSupervisorList": [],
        "theme": {
            "primaryrgb": "rgb(58,131,255)",
            "headerrgb": "rgb(58,131,255)"
        },
        "lastModifiedOn": 1596436824000,
        "location": {
            "lat": 6.021034052466086,
            "lng": 116.12464023715202,
            "imageUrl": "/images/lowRisk.png"
        },
        "phoneNumber": "60123456789",
        "licenceNumber": "<YOUR IC NUMBER>",
        "postcode": "<YOUR POSTCODE>",
        "address": "<YOUR ADDRESS>",
        "homeLocation": null,
        "hasHighRiskDependents": null,
        "isInterested": true,
        "firstLogin": false,
        "isDemoUser": false,
        "isTodoEnabled": true,
        "isScorecardHistoryEnabled": false,
        "showDisplayPictureAsTenantLogo": false,
        "canShare": false,
        "canDiscuss": false,
        "hasTeam": false,
        "analyticsEnabled": false,
        "eligibleForVaccine": false,
        "selfVerified": true,
        "nonVaccinationAccount": false,
        "passportNumber": null,
        "dateOfBirth": null,
        "tenantImageUrl": "https://mysejahtera.malaysia.gov.my/epms/noAuth/image/27/TENANT_IMAGE/27_2750d863-e6ce-450b-8d4e-dxxxb.png",
        "tenantFont": null,
        "tenantLogoUrl": "https://mysejahtera.malaysia.gov.my/epms/noAuth/image/27/TENANT_LOGO/27_9439be0d-b332-4fa1-b527-d0c3cb9b727cxxxPinA.png",
        "tenantName": "MySejahtera",
        "tenantLoaderUrl": null,
        "verificationStatus": "NOT_YET_STARTED",
        "editableFields": ["IMAGE", "DOB", "PASSPORT_NUMBER"]
    },
    "vaccineDependents": []
}

3. Get personal vax status

curl --location --request GET 'https://mysejahtera.malaysia.gov.my/epms/v1/mobileApp/vaccination/processFlow' \
--header 'Accept-Language: en-MY;q=1, zh-Hans-MY;q=0.9' \
--header 'User-Agent: MySejahtera/1.0.36 (iPhone; iOS 14.4.2; Scale/2.00)' \
--header 'Connection: keep-alive' \
--header 'Content-Type: application/json' \
--header 'Host: mysejahtera.malaysia.gov.my' \
--header 'x-auth-token: <INSERT YOUR X-AUTH-TOKEN>' \

Response:

  • X-AUTH-TOKEN in header
View body returned
[
    {
        "timestamp": "03-Mar",
        "headerText": {
            "ms_MY": "Berdaftar",
            "en_US": "Registered"
        },
        "state": "COMPLETED",
        "data": [
            {
                "text": {
                    "ms_MY": "Notis:",
                    "en_US": "Note:"
                },
                "value": "Anda telah berjaya mendaftar untuk Program Imunisasi COVID-19 Kebangsaan. Langkah seterusnya akan dibuka setelah anda layak untuk menerima vaksinasi seperti yang dirancang oleh kerajaan. / You have successfully registered for the vaccination program. The next steps will be enabled once you become eligible as per the National Immunization Plan"
            }
        ],
        "action": []
    },
    {
        "timestamp": "04-Jun",
        "headerText": {
            "ms_MY": "Penilaian",
            "en_US": "Assessment"
        },
        "state": "ACTIVE",
        "data": [],
        "action": [
            {
                "text": {
                    "ms_MY": "1. Kemaskini maklumat pendaftaran anda",
                    "en_US": "1. Update your registration details"
                },
                "value": "PRE_SCREENING_ASSESSMENT"
            },
            {
                "text": {
                    "ms_MY": "2. Kemaskini alamat tempat tinggal semasa anda",
                    "en_US": "2. Update your home address"
                },
                "value": "UPDATE_ADDRESS_ASSESSMENT"
            },
            {
                "text": {
                    "ms_MY": "3. Klik jika hamil / menyusukan anak",
                    "en_US": "3. Click if pregnant / breastfeeding"
                },
                "value": "PREGNANCY_ASSESSMENT"
            }
        ]
    },
    {
        "timestamp": null,
        "headerText": {
            "ms_MY": "Layak untuk vaksinasi?",
            "en_US": "Eligible for vaccine?"
        },
        "state": "PENDING",
        "data": [],
        "action": []
    },
    {
        "timestamp": null,
        "headerText": {
            "ms_MY": "Temu janji Dos 1",
            "en_US": "1st Dose appointment"
        },
        "state": "PENDING",
        "data": [],
        "action": []
    },
    {
        "timestamp": null,
        "headerText": {
            "ms_MY": "Dos 1 selesai",
            "en_US": "1st Dose completed"
        },
        "state": "PENDING",
        "data": [],
        "action": []
    },
    {
        "timestamp": null,
        "headerText": {
            "ms_MY": "Temu janji Dos 2",
            "en_US": "2nd Dose appointment"
        },
        "state": "PENDING",
        "data": [],
        "action": []
    },
    {
        "timestamp": null,
        "headerText": {
            "ms_MY": "Dos 2 selesai",
            "en_US": "2nd Dose completed"
        },
        "state": "PENDING",
        "data": [],
        "action": []
    },
    {
        "timestamp": null,
        "headerText": {
            "ms_MY": "Sijil digital dikeluarkan",
            "en_US": "Digital certificate issued"
        },
        "state": "PENDING",
        "data": [],
        "action": []
    }
]

4. Forgot password

curl --location --request POST 'https://mysejahtera.malaysia.gov.my/register/forgotPassword' \
--header 'Connection: keep-alive' \
--header 'Accept-Language: en-MY;q=1, zh-Hans-MY;q=0.9' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Content-Length: 33' \
--header 'User-Agent: MySejahtera/1.0.36 (iPhone; iOS 14.4.2; Scale/2.00)' \
--header 'Host: mysejahtera.malaysia.gov.my' \
--data-raw '{"emailOrUserName":"60123456789"}'

Response:

  • 200 status code if success

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the GPL v3 License. See LICENSE for more information.

Contact

Project Link: https://github.com/nubpro/nakvaksin

nakvaksin's People

Contributors

chengkangzai avatar nubpro avatar qhkm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.