whatsapp-business-java-sdk

:scroll: Managing phone numbers

You can:

See the examples:

Get a phone number data list:

WhatsappApiFactory factory = WhatsappApiFactory.newInstance();

WhatsappBusinessManagementApi whatsappBusinessManagementApi = factory.newBusinessManagementApi(TestConstants.TOKEN);

var phoneNumbers = whatsappBusinessManagementApi.retrievePhoneNumbers(TestConstants.WABA_ID);

ObjectMapper mapper = new ObjectMapper();

System.out.println(mapper.writeValueAsString(phoneNumbers));

Get a phone number data by id:

WhatsappApiFactory factory = WhatsappApiFactory.newInstance();

WhatsappBusinessManagementApi whatsappBusinessManagementApi = factory.newBusinessManagementApi(TestConstants.TOKEN);

var phoneNumber = whatsappBusinessManagementApi.retrievePhoneNumber(TestConstants.PHONE_NUMBER_ID);

ObjectMapper mapper = new ObjectMapper();

System.out.println(mapper.writeValueAsString(phoneNumber));

Get a phone number data with specific fields:

WhatsappApiFactory factory = WhatsappApiFactory.newInstance();

WhatsappBusinessManagementApi whatsappBusinessManagementApi = factory.newBusinessManagementApi(TestConstants.TOKEN);

var phoneNumber = whatsappBusinessManagementApi.retrievePhoneNumber(TestConstants.PHONE_NUMBER_ID, "name_status", "verified_name");

ObjectMapper mapper = new ObjectMapper();

System.out.println(mapper.writeValueAsString(phoneNumber));

See full examples here

:arrow_heading_up: back