从 WhatsApp 模板迁移到内容生成器

问题描述 投票:0回答:1

我正在将 Twilio 的

WhatsApp template
迁移到他们的
Content Builder
,并将所有模板移至内容模板。我无法接收号召性用语按钮。

例如,这是我的内容

模板 ID:

HX5fc0f957dc40af96ce9ef7055a2c7b22
包含以下模板详细信息

You entered: {{1}}

Do you confirm?

和身体:

You entered: 789660****3871

Do you confirm?`

我在遵循此doc

后使用以下代码
await twilioClient.messages.create({
  contentSid: "HX5fc0f957dc40af96ce9ef7055a2c7b22",
  body: messageBody,
  from: TWILIO_PHONE_NUMBER,
  contentVariables: JSON.stringify({
    1: '789660****3871'
  }),
  to: to,
});

在日志中,我看到:

## Warning - 12200 ### Schema validation warning The provided XML does not conform to the Twilio Markup XML schema. Please refer to the specific error and correct the problem.

我无法理解我在这里做错了什么。我还发送了

contentSid
contentVariables
,这两个都是以前不需要的。

有任何提示或可能的解决方案吗?

twilio whatsapp twilio-api twilio-programmable-chat
1个回答
0
投票

我相信您可能会因为对 Content API 功能的误解而面临困难。值得注意的是,Content API 不支持

body
参数。

这可能是无法发送消息的原因。另请注意,使用 Content API 时,您需要指定消息服务作为发件人(请参阅“开始之前”部分)。

await twilioClient.messages.create({
  contentSid: "HX5fc0f957dc40af96ce9ef7055a2c7b22",
  from: TWILIO_MESSAGING_SERVICE_SID,
  contentVariables: JSON.stringify({
    1: '789660****3871'
  }),
  to: to,
});

此外,值得验证您选择的内容模板的性质 - 具体来说,它本身是否根据您的要求包含“号召性用语”按钮?

© www.soinside.com 2019 - 2024. All rights reserved.