kodingworks / otpwa

https://otpwa.com
9 stars 2 forks source link

Add Endpoint to Get QR #4

Closed arifwidianto08 closed 2 years ago

arifwidianto08 commented 2 years ago

Description

Convert the QR response from the Baileys to an image and create a new endpoint to Get it.

Proposal

Acceptance Criteria

Routes

A. QR

1. GET QR Image URL

URL : {{url}}/api/whatsapp/qr

Response :

a. Sucess - Disconnected
{
    "meta": {
        "message": "Your phone is offline.",
        "statusCode": 200
    },
    "data": {
        "qr_image_url": "https://warung-io.s3.ap-southeast-1.amazonaws.com/qr.svg"
    }
}
b. Sucess - Online
{
    "meta": {
        "message": "Your phone is online.",
        "statusCode": 200
    },
    "data": {
        "qr_image_url": null
    }
}

A. Connection Status

1. GET Connection Status

URL : {{url}}/api/whatsapp/status

Response :

a. Sucess - Disconnected
{
    "meta": {
        "message": "Your phone is offline.",
        "statusCode": 200
    },
    "data": {
        "status": "offline"
    }
}
b. Sucess - Online
{
    "meta": {
        "message": "Your phone is online.",
        "statusCode": 200
    },
    "data": {
        "status": "online"
    }
}

References

arifwidianto08 commented 2 years ago

Permisi Mas @ariaseta , minta tolong direview ya Mas, makasih.

arifwidianto08 commented 2 years ago

Changelog :

  1. Add endpoint {{url}}/api/whatsapp/qr to Get QR Image URL and Bot Connection Status.
  2. Add new dependency qrcode to convert QR Token from the Baileys to QR Code Image.

Preview :

https://watch.screencastify.com/v/0Tfv7uT2u33SaIlGQDpF

cc Mas @ariaseta

arifwidianto08 commented 2 years ago

Minta tolong direview kembali ya Mas @ariaseta proposalnya, terimakasih.

arifwidianto08 commented 2 years ago

Changelog

  1. Add new endpoint to Get QR Image URL
  2. Add new endpoint to Get Current Bot Connection Status

Preview

Routes

A. QR

1. GET QR Image URL

URL : {{url}}/api/whatsapp/qr

Response :

a. Sucess - Offline
{
    "data": {
        "qr_image_url": "http://localhost:3000/qr/qr.png"
    },
    "meta": {
        "message": "Your bot is offline.",
        "statusCode": 200
    }
}
b. Sucess - Online
{
    "meta": {
        "message": "Your phone is online.",
        "statusCode": 200
    },
    "data": {
        "qr_image_url": null
    }
}

B. Bot Connection Status

1. GET Status ( Bot Connection Status )

URL : {{url}}/api/whatsapp/status

Response :

a. Sucess - Offline
{
    "data": {
        "status": "OFFLINE"
    },
    "meta": {
        "message": "Your bot is online.",
        "statusCode": 200
    }
}
b. Sucess - Online
{
    "data": {
        "status": "ONLINE"
    },
    "meta": {
        "message": "Your bot is online.",
        "statusCode": 200
    }
}

Screenrecord :

cc Mas @ariaseta