@@ -32,17 +32,116 @@ func NewPhoneNumberManager(config *PhoneNumberManagerConfig) *PhoneNumberManager
3232 }
3333}
3434
35+ type WhatsappBusinessAccountPhoneNumberCodeVerificationStatus string
36+
37+ const (
38+ WhatsappBusinessAccountPhoneNumberCodeVerificationStatusVerified WhatsappBusinessAccountPhoneNumberCodeVerificationStatus = "VERIFIED"
39+ WhatsappBusinessAccountPhoneNumberCodeVerificationStatusNotVerified WhatsappBusinessAccountPhoneNumberCodeVerificationStatus = "NOT_VERIFIED"
40+ WhatsappBusinessAccountPhoneNumberCodeVerificationStatusExpired WhatsappBusinessAccountPhoneNumberCodeVerificationStatus = "EXPIRED"
41+ )
42+
43+ type WhatsappBusinessAccountPhoneNumberMessagingLimitTier string
44+
45+ const (
46+ WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier50 WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_50"
47+ WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier250 WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_250"
48+ WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier1K WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_1K"
49+ WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier10K WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_10K"
50+ WhatsappBusinessAccountPhoneNumberMessagingLimitTierTier100K WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_100K"
51+ WhatsappBusinessAccountPhoneNumberMessagingLimitTierTierUnlimited WhatsappBusinessAccountPhoneNumberMessagingLimitTier = "TIER_UNLIMITED"
52+ )
53+
54+ type WhatsappBusinessAccountPhoneNumberNameStatus string
55+
56+ const (
57+ WhatsappBusinessAccountPhoneNumberNameStatusApproved WhatsappBusinessAccountPhoneNumberNameStatus = "APPROVED"
58+ WhatsappBusinessAccountPhoneNumberNameStatusAvailableWithoutReview WhatsappBusinessAccountPhoneNumberNameStatus = "AVAILABLE_WITHOUT_REVIEW"
59+ WhatsappBusinessAccountPhoneNumberNameStatusDeclined WhatsappBusinessAccountPhoneNumberNameStatus = "DECLINED"
60+ WhatsappBusinessAccountPhoneNumberNameStatusExpired WhatsappBusinessAccountPhoneNumberNameStatus = "EXPIRED"
61+ WhatsappBusinessAccountPhoneNumberNameStatusNonExists WhatsappBusinessAccountPhoneNumberNameStatus = "NON_EXISTS"
62+ WhatsappBusinessAccountPhoneNumberNameStatusNone WhatsappBusinessAccountPhoneNumberNameStatus = "NONE"
63+ WhatsappBusinessAccountPhoneNumberNameStatusPendingReview WhatsappBusinessAccountPhoneNumberNameStatus = "PENDING_REVIEW"
64+ )
65+
66+ type WhatsappBusinessAccountPhoneNumberPlatformType string
67+
68+ const (
69+ WhatsappBusinessAccountPhoneNumberPlatformTypeCloudApi WhatsappBusinessAccountPhoneNumberPlatformType = "CLOUD_API"
70+ WhatsappBusinessAccountPhoneNumberPlatformTypeNotApplicable WhatsappBusinessAccountPhoneNumberPlatformType = "NOT_APPLICABLE"
71+ WhatsappBusinessAccountPhoneNumberPlatformTypeOnPremise WhatsappBusinessAccountPhoneNumberPlatformType = "ON_PREMISE"
72+ )
73+
74+ type WhatsappBusinessAccountPhoneNumberStatus string
75+
76+ const (
77+ WhatsappBusinessAccountPhoneNumberStatusPending WhatsappBusinessAccountPhoneNumberStatus = "PENDING"
78+ WhatsappBusinessAccountPhoneNumberStatusDeleted WhatsappBusinessAccountPhoneNumberStatus = "DELETED"
79+ WhatsappBusinessAccountPhoneNumberStatusMigrated WhatsappBusinessAccountPhoneNumberStatus = "MIGRATED"
80+ WhatsappBusinessAccountPhoneNumberStatusBanned WhatsappBusinessAccountPhoneNumberStatus = "BANNED"
81+ WhatsappBusinessAccountPhoneNumberStatusRestricted WhatsappBusinessAccountPhoneNumberStatus = "RESTRICTED"
82+ WhatsappBusinessAccountPhoneNumberStatusRateLimited WhatsappBusinessAccountPhoneNumberStatus = "RATE_LIMITED"
83+ WhatsappBusinessAccountPhoneNumberStatusFlagged WhatsappBusinessAccountPhoneNumberStatus = "FLAGGED"
84+ WhatsappBusinessAccountPhoneNumberStatusConnected WhatsappBusinessAccountPhoneNumberStatus = "CONNECTED"
85+ WhatsappBusinessAccountPhoneNumberStatusDisconnected WhatsappBusinessAccountPhoneNumberStatus = "DISCONNECTED"
86+ WhatsappBusinessAccountPhoneNumberStatusUnknown WhatsappBusinessAccountPhoneNumberStatus = "UNKNOWN"
87+ WhatsappBusinessAccountPhoneNumberStatusUnverified WhatsappBusinessAccountPhoneNumberStatus = "UNVERIFIED"
88+ )
89+
90+ type WabaHealthStatus struct {
91+ CanSendMessage string `json:"can_send_message"`
92+ Entities []struct {
93+ EntityType string `json:"entity_type"`
94+ ID string `json:"id"`
95+ CanSendMessage string `json:"can_send_message,omitempty"`
96+ CanReceiveCallSIP string `json:"can_receive_call_sip,omitempty"`
97+ Errors []struct {
98+ ErrorCode int `json:"error_code"`
99+ ErrorDescription string `json:"error_description"`
100+ PossibleSolution string `json:"possible_solution"`
101+ } `json:"errors,omitempty"`
102+ } `json:"entities"`
103+ }
104+
105+ type WabaQualityScore struct {
106+ Score string `json:"score"`
107+ }
108+
109+ type WabaThroughput struct {
110+ Level string `json:"level"`
111+ }
112+
113+ type WabaOfficialBusinessAccount struct {
114+ OBAStatus string `json:"oba_status"`
115+ }
116+
35117// WhatsappBusinessAccountPhoneNumber represents a WhatsApp Business Account phone number.
36118type WhatsappBusinessAccountPhoneNumber struct {
37- VerifiedName string `json:"verified_name,omitempty"`
38- DisplayPhoneNumber string `json:"display_phone_number,omitempty"`
39- Id string `json:"id,omitempty"`
40- QualityRating string `json:"quality_rating,omitempty"`
41- CodeVerificationStatus string `json:"code_verification_status,omitempty"`
42- Status string `json:"status,omitempty"` // CONNECTED
43- PlatformType string `json:"platform_type,omitempty"`
44- CountryDialCode string `json:"country_dial_code,omitempty"`
45- SearchVisibility string `json:"search_visibility,omitempty"`
119+ VerifiedName string `json:"verified_name,omitempty"`
120+ DisplayPhoneNumber string `json:"display_phone_number,omitempty"`
121+ Id string `json:"id,omitempty"`
122+ QualityRating string `json:"quality_rating,omitempty"`
123+ CodeVerificationStatus WhatsappBusinessAccountPhoneNumberCodeVerificationStatus `json:"code_verification_status,omitempty"`
124+ Status WhatsappBusinessAccountPhoneNumberStatus `json:"status,omitempty"` // CONNECTED
125+ PlatformType WhatsappBusinessAccountPhoneNumberPlatformType `json:"platform_type,omitempty"`
126+ CountryDialCode string `json:"country_dial_code,omitempty"`
127+ SearchVisibility string `json:"search_visibility,omitempty"`
128+ Certificate string `json:"certificate,omitempty"`
129+ HealthStatus * WabaHealthStatus `json:"health_status,omitempty"`
130+ IsOfficialBusinessAccount bool `json:"is_official_business_account,omitempty"`
131+ IsOnBizApp bool `json:"is_on_biz_app,omitempty"`
132+ IsPinEnabled bool `json:"is_pin_enabled,omitempty"`
133+ IsPreverifiedNumber bool `json:"is_preverified_number,omitempty"`
134+ LastOnboardedTime string `json:"last_onboarded_time,omitempty"`
135+ MessagingLimitTier WhatsappBusinessAccountPhoneNumberMessagingLimitTier `json:"messaging_limit_tier,omitempty"`
136+ NameStatus WhatsappBusinessAccountPhoneNumberNameStatus `json:"name_status,omitempty"`
137+ NewCertificate string `json:"new_certificate,omitempty"`
138+ NewDisplayName string `json:"new_display_name,omitempty"`
139+ NewNameStatus WhatsappBusinessAccountPhoneNumberNameStatus `json:"new_name_status,omitempty"`
140+ EligibilityForApiBusinessGlobalSearch string `json:"eligibility_for_api_business_global_search,omitempty"`
141+ AccountMode string `json:"account_mode,omitempty"`
142+ Throughput * WabaThroughput `json:"throughput,omitempty"`
143+ OfficialBusinessAccount * WabaOfficialBusinessAccount `json:"official_business_account,omitempty"`
144+ QualityScore * WabaQualityScore `json:"quality_score,omitempty"`
46145}
47146
48147// WhatsappBusinessAccountPhoneNumberEdge represents a list of WhatsApp Business Account phone numbers.
@@ -56,6 +155,7 @@ type WhatsappBusinessAccountPhoneNumberEdge struct {
56155func (manager * PhoneNumberManager ) FetchAll (getSandBoxNumbers bool ) (* WhatsappBusinessAccountPhoneNumberEdge , error ) {
57156 apiRequest := manager .requester .NewApiRequest (strings .Join ([]string {manager .businessAccountId , "/" , "phone_numbers" }, "" ), http .MethodGet )
58157
158+ apiRequest .AddQueryParam ("fields" , "id,account_mode,certificate,code_verification_status,conversational_automation,display_phone_number,health_status,eligibility_for_api_business_global_search,id,is_official_business_account,is_on_biz_app,is_pin_enabled,is_preverified_number,last_onboarded_time,messaging_limit_tier,name_status,new_certificate,new_display_name,new_name_status,official_business_account,platform_type,quality_score,search_visibility,status,throughput,verified_name" )
59159 apiRequest .AddQueryParam ("filtering" , `[{"field":"account_mode","operator":"EQUAL","value":"LIVE"}]` )
60160 response , err := apiRequest .Execute ()
61161
@@ -72,7 +172,7 @@ func (manager *PhoneNumberManager) FetchAll(getSandBoxNumbers bool) (*WhatsappBu
72172// Fetch fetches a phone number by its ID.
73173func (manager * PhoneNumberManager ) Fetch (phoneNumberId string ) (* WhatsappBusinessAccountPhoneNumber , error ) {
74174 apiRequest := manager .requester .NewApiRequest (phoneNumberId , http .MethodGet )
75-
175+ apiRequest . AddQueryParam ( "fields" , "id,account_mode,certificate,code_verification_status,conversational_automation,display_phone_number,health_status,eligibility_for_api_business_global_search,id,is_official_business_account,is_on_biz_app,is_pin_enabled,is_preverified_number,last_onboarded_time,messaging_limit_tier,name_status,new_certificate,new_display_name,new_name_status,official_business_account,platform_type,quality_score,search_visibility,status,throughput,verified_name" )
76176 response , err := apiRequest .Execute ()
77177
78178 if err != nil {
0 commit comments