* Implement endpoints for managing business profiles: - Get business profile - Update business profile * Add catalog management features: - List catalogs - List products in a catalog - Send catalog messages - Send single product messages - Send product list messages * Introduce media upload functionality for sending media files. * Add flow management capabilities: - Deprecate flows * Update API documentation to reflect new endpoints and features.
29 lines
925 B
Go
29 lines
925 B
Go
package businessapi
|
|
|
|
import (
|
|
"context"
|
|
"net/url"
|
|
)
|
|
|
|
// GetBusinessProfile retrieves the business profile for this phone number.
|
|
func (c *Client) GetBusinessProfile(ctx context.Context) (*BusinessProfile, error) {
|
|
params := url.Values{
|
|
"fields": {"about,address,description,email,websites,vertical,profile_picture_url"},
|
|
}
|
|
|
|
var resp BusinessProfile
|
|
if err := c.graphAPIGet(ctx, c.config.PhoneNumberID+"/whatsapp_business_profile", params, &resp); err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|
|
|
|
// UpdateBusinessProfile updates one or more business profile fields.
|
|
// Only include fields you want to change — omitted fields are left untouched.
|
|
func (c *Client) UpdateBusinessProfile(ctx context.Context, profile BusinessProfileUpdate) error {
|
|
profile.MessagingProduct = "whatsapp"
|
|
|
|
var resp map[string]any
|
|
return c.graphAPIPost(ctx, c.config.PhoneNumberID+"/whatsapp_business_profile", profile, &resp)
|
|
}
|