More management tools
Some checks failed
CI / Test (1.22) (push) Failing after -30m28s
CI / Lint (push) Failing after -30m32s
CI / Build (push) Failing after -30m31s
CI / Test (1.23) (push) Failing after -30m31s

This commit is contained in:
2026-03-04 22:30:40 +02:00
parent 4a716bb82d
commit 4b44340c58
25 changed files with 3094 additions and 230 deletions

View File

@@ -7,8 +7,9 @@ import (
// ListFlows returns all flows for the business account.
func (c *Client) ListFlows(ctx context.Context) (*FlowListResponse, error) {
if c.config.BusinessAccountID == "" {
return nil, errNoBusinessAccount
wabaID, err := c.resolveWABAID(ctx)
if err != nil {
return nil, err
}
params := url.Values{
@@ -16,7 +17,7 @@ func (c *Client) ListFlows(ctx context.Context) (*FlowListResponse, error) {
}
var resp FlowListResponse
if err := c.graphAPIGet(ctx, c.config.BusinessAccountID+"/flows", params, &resp); err != nil {
if err := c.graphAPIGet(ctx, wabaID+"/flows", params, &resp); err != nil {
return nil, err
}
return &resp, nil
@@ -24,12 +25,13 @@ func (c *Client) ListFlows(ctx context.Context) (*FlowListResponse, error) {
// CreateFlow creates a new flow and returns its ID.
func (c *Client) CreateFlow(ctx context.Context, flow FlowCreateRequest) (*FlowCreateResponse, error) {
if c.config.BusinessAccountID == "" {
return nil, errNoBusinessAccount
wabaID, err := c.resolveWABAID(ctx)
if err != nil {
return nil, err
}
var resp FlowCreateResponse
if err := c.graphAPIPost(ctx, c.config.BusinessAccountID+"/flows", flow, &resp); err != nil {
if err := c.graphAPIPost(ctx, wabaID+"/flows", flow, &resp); err != nil {
return nil, err
}
return &resp, nil