You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

关于Twilio支持WhatsApp轮播模板及WABA对接的技术问询

关于Twilio与WhatsApp轮播模板的问题解答

1. Twilio是否计划支持Facebook文档中所述的WhatsApp轮播模板的创建与发送?

Twilio目前已支持发送WhatsApp轮播消息,包括使用Meta定义的轮播模板。对于模板创建,当前推荐通过Meta的WABA渠道完成,审核通过的模板会同步到你的Twilio账号。Twilio会持续迭代功能,后续可能支持直接在其控制台/API中创建轮播模板,但当前暂需通过WABA侧操作。

2. 是否可直接通过WABA创建轮播模板并审核后用Twilio发送?

可以。具体操作流程:

  • 确保你的Twilio账号已关联对应的WABA(WhatsApp Business Account);
  • 登录Meta Business Manager或WhatsApp Business Platform后台,创建符合规范的轮播模板并提交审核;
  • 审核通过后,模板会自动同步到你的Twilio账号;
  • 之后即可通过Twilio API引用该模板的名称或SID发送轮播消息。

3. 如何通过Twilio发送轮播内容?

分两种场景操作:

场景一:使用审核通过的轮播模板(适用于会话外消息)

通过Twilio API调用已审核的模板,示例Python代码:

from twilio.rest import Client

# 替换为你的Twilio账号信息
account_sid = "YOUR_ACCOUNT_SID"
auth_token = "YOUR_AUTH_TOKEN"
client = Client(account_sid, auth_token)

message = client.messages.create(
    from_="whatsapp:+14155238886",  # 你的Twilio WhatsApp号码
    to="whatsapp:+15005550006",    # 目标用户号码
    content={
        "type": "template",
        "template": {
            "name": "APPROVED_CAROUSEL_TEMPLATE_NAME",  # 审核通过的模板名称
            "language": {"code": "en_US"},
            "components": [
                {
                    "type": "body",
                    "parameters": [{"type": "text", "text": "Welcome to our store"}]
                },
                {
                    "type": "carousel",
                    "parameters": [
                        {
                            "type": "carousel_item",
                            "parameters": [
                                {"type": "text", "text": "Wireless Headphones"},
                                {"type": "text", "text": "Noise-cancelling, 30hr battery"},
                                {"type": "image", "image": {"link": "https://example.com/headphones.jpg"}}
                            ]
                        },
                        {
                            "type": "carousel_item",
                            "parameters": [
                                {"type": "text", "text": "Smart Watch"},
                                {"type": "text", "text": "Heart rate monitor, waterproof"},
                                {"type": "image", "image": {"link": "https://example.com/watch.jpg"}}
                            ]
                        }
                    ]
                }
            ]
        }
    }
)

print(f"Message sent with SID: {message.sid}")

场景二:发送会话内轮播消息(24小时会话窗口内,无需模板)

若用户在24小时内与你的账号有交互,可直接发送交互式轮播消息,示例Python代码:

from twilio.rest import Client

account_sid = "YOUR_ACCOUNT_SID"
auth_token = "YOUR_AUTH_TOKEN"
client = Client(account_sid, auth_token)

message = client.messages.create(
    from_="whatsapp:+14155238886",
    to="whatsapp:+15005550006",
    content={
        "type": "interactive",
        "interactive": {
            "type": "carousel",
            "body": {"text": "Check out our top picks:"},
            "action": {
                "sections": [
                    {
                        "title": "Electronics",
                        "rows": [
                            {"id": "electronics_headphones", "title": "Wireless Headphones", "description": "Noise-cancelling, 30hr battery"}
                        ]
                    },
                    {
                        "title": "Wearables",
                        "rows": [
                            {"id": "wearables_watch", "title": "Smart Watch", "description": "Heart rate monitor, waterproof"}
                        ]
                    }
                ]
            }
        }
    }
)

print(f"Message sent with SID: {message.sid}")

内容的提问来源于stack exchange,提问作者Tiago

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 22:57:35