//native
/**
* Get Business Profile
* Retrieve the WhatsApp business profile (about, address, description, email, websites, vertical, profile picture) of the business phone number.
*/
export async function main(auth: RT.WhatsappBusiness) {
const apiVersion = auth.api_version || "v25.0"
const url = new URL(
`https://graph.facebook.com/${apiVersion}/${auth.phone_number_id}/whatsapp_business_profile`
)
url.searchParams.append(
"fields",
"about,address,description,email,profile_picture_url,websites,vertical"
)
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: `Bearer ${auth.token}`,
Accept: "application/json",
},
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 5 hours ago