feat(api): 🎉 Add business profile and catalog management
* 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.
This commit is contained in:
28
pkg/whatsapp/businessapi/profile.go
Normal file
28
pkg/whatsapp/businessapi/profile.go
Normal file
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user