22 lines
542 B
TypeScript
22 lines
542 B
TypeScript
|
import whatsappOfficialAPI from "./WhatsappOfficialAPI";
|
||
|
|
||
|
async function whatsappOfficialNumberInfo(wabaId: string) {
|
||
|
try {
|
||
|
const { data } = await whatsappOfficialAPI.get(
|
||
|
`/${process.env.VERSION}/${wabaId}/phone_numbers`
|
||
|
);
|
||
|
console.log("data: ", data);
|
||
|
|
||
|
if (data && Object.keys(data).length > 0) {
|
||
|
return data.data[0];
|
||
|
}
|
||
|
} catch (error) {
|
||
|
console.log(
|
||
|
`There was an error into whatsappOfficialNumberInfo method : ${error}`
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
export default whatsappOfficialNumberInfo;
|