How Businesses can Check Health Status of Employees with Aarogya Setu

How Businesses can Check Health Status of Employees with Aarogya Setu

The Government of India has as of late presented an “open API” for Aarogya Setu, the world’s most mainstream contact following application that has in excess of 110 million clients across the Android and iOS stage. The Aarogya Setu API, in straightforward English, will assist associations with checking the wellbeing status of their representatives.

At present, when a representative enters their office, they are needed to show their Aarogya Setu application at the gathering and are permitted section just if the status is green importance they haven’t been in closeness of a tainted individual. With the API in spots, business can consequently realize the danger level of their workers.

This could save some exertion since the HR office can make a Google Sheet with the telephone quantities, everything being equal, and a Google Script can naturally get the wellbeing status of each number in that rundown. The content would then be able to email the rundown of representatives who are at moderate or high danger for additional activity.

Instructions to Use the Aarogya Setu API

You can pursue the API at This is definitely not a direct cycle – you need to send an email and endorsement is conceded just if your business has in excess of 50 workers. Accepting your business has been allowed admittance to the API, here’s the means by which you can utilize it with Google Sheets and Google Scripts.

class AaryogyaSetu {
  constructor({ apiKey, userName, password }) {
    this.apiKey = apiKey;
    this.userName = userName;
    this.password = password;
    this.api = "";
    this.token = null;

  /* Get the authorization token for the header
     The token is valid for 1 hour */
  getToken() {
    if (this.token === null) {
      const { token } = this.fetch("/token", {
        username: this.userName,
        password: this.password,
      this.token = token;
    return this.token;

  /* Request Aarogya Setu status of a
     user using phone number of the user */
  getUserStatus(phone_number) {
    const { request_id, request_status } = this.fetch("/userstatus", {
    return request_status !== "Approved";

  fetch(endpoint, payload) {
    const mimeType = "application/json";
    const headers = {
      Accept: mimeType,
      "Content-Type": mimeType,
      "x-api-key": this.apiKey,
    if (endpoint !== "/token") {
      headers["Authorization"] = this.getToken();
    const options = {
      method: "POST",
      contentType: mimeType,
      headers: headers,
      payload: JSON.stringify(payload),
    const url = `${this.api}${endpoint}`;
    const response = UrlFetchApp.fetch(url, options);
    return JSON.parse(response.getContentText());

/* The API key can be found in your Aarogya Setu dashboard */
const main = () => {
  const aarogyasetu = new AaryogyaSetu({
    apiKey: "xyz1234",
    username: "",
    password: "India1234",

  const phoneNumber = "9760008500";
  const userStatus = aarogyasetu.getUserStatus(phoneNumber);
  if (!userStatus) {
    console.log(`The Aarogya Setu status of ${phoneNumber} was denied`);

At the point when you make a solicitation to the Aarogya Setu API mentioning the danger status of a representative recognized by their telephone number, a notice is shipped off the Aarogya Setu client. On the off chance that they endorse the status (or in the event that they have pre-affirmed the solicitation prior), a POST solicitation is made to your callback URL with the assistance status of the client.

The Google Script can be distributed as a web application with the doPost strategy and that be utilized as a callback URL for the Open API.

Leave a Reply

Your email address will not be published. Required fields are marked *