0

Get Business Profile

by
Published today

Retrieve the WhatsApp business profile (about, address, description, email, websites, vertical, profile picture) of the business phone number.

Script whatsapp_business Verified

The script

Submitted by hugo989 Typescript (fetch-only)
Verified 4 hours ago
1
//native
2

3
/**
4
 * Get Business Profile
5
 * Retrieve the WhatsApp business profile (about, address, description, email, websites, vertical, profile picture) of the business phone number.
6
 */
7
export async function main(auth: RT.WhatsappBusiness) {
8
  const apiVersion = auth.api_version || "v25.0"
9
  const url = new URL(
10
    `https://graph.facebook.com/${apiVersion}/${auth.phone_number_id}/whatsapp_business_profile`
11
  )
12
  url.searchParams.append(
13
    "fields",
14
    "about,address,description,email,profile_picture_url,websites,vertical"
15
  )
16

17
  const response = await fetch(url, {
18
    method: "GET",
19
    headers: {
20
      Authorization: `Bearer ${auth.token}`,
21
      Accept: "application/json",
22
    },
23
  })
24

25
  if (!response.ok) {
26
    throw new Error(`${response.status} ${await response.text()}`)
27
  }
28

29
  return await response.json()
30
}
31