router_function_list_nomor.js


const kei = require('../../lib/sendMessage');
const db = require('../../db/db');
const { KeiLog } = require('../../lib/Logger');
const konfig = require('../../config.js');
const axios = require('axios');
/**
 * Module for listing phone numbers associated with a WhatsApp Business API account.
 *@module list_nomor
 * @param {object} app - The Express application object.
 */
module.exports = async function (app) {
  app.get("/list_nomor", async (req, res) => {
    // Parse the request body from the POST
    // let body = "test";

    //console.log(body);

    var config = {
      method: 'get',
      url: 'https://graph.facebook.com/v16.0/' + konfig.waba_id + '/phone_numbers',
      headers: {
        'Authorization': "Bearer " + konfig.token
      }
    };


    axios(config)
      .then(function (response) {
        res.send(JSON.stringify(response.data));
      })
      .catch(function (error) {
        res.send(error);
      });

  });


};