我可以通过使用Twilio将英雄卡发送到Whats应用程序

发布于 2025-02-07 11:23:58 字数 299 浏览 2 评论 0 原文

我有聊天机器人,使用bot框架nodejs sdk构建它,我将此聊天机集成到whatsapp,我想在whatsapp聊天中显示一些按钮,

所以是否有人找到了解决这个问题的解决方案,请帮助我

注意:我尝试发送英雄卡,但我跑到问题

Error: TwilioWhatsAppAdapter.parseActivity():
 An activity text or attachment with contentUrl must be specified.

I have chat bot, I build it with bot framework nodejs SDK I integrate this chat bot to whatsapp and I want to display some buttons in the whatsapp chat,

So is there any one found a solution for this problem pleas help me

Note: I try to send a hero card but I run to problem

Error: TwilioWhatsAppAdapter.parseActivity():
 An activity text or attachment with contentUrl must be specified.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

童话里做英雄 2025-02-14 11:23:58

我不知道Bot Framework如何尝试使用按钮发送WhatsApp消息,但我怀疑这符合Twilio想要发送的方式。

当前,要使用按钮发送消息,您需要注册并使用模板消息。当您发送与模板之一匹配的消息的文本时,Twilio也将使用按钮传递整个模板。

对于将来,请注意 twilio noreferrer“> twilio content api api 将简化跨平台的模板,按钮和其他丰富消息。

I don't know how bot framework attempts to send WhatsApp messages with buttons, but I doubt it fits with the way Twilio wants to send them.

Currently, to send a message with buttons, you need to register and use a template message. When you send the text of a message that matches one of your templates, then Twilio will deliver the entire template with buttons as well.

For the future, look out for the Twilio Content API which will streamline templates, buttons and other rich messages across platforms.

心房的律动 2025-02-14 11:23:58

看起来您正在使用来自Botbuilder-Community-JS Repo。

查看适配器的代码,它似乎没有配置为处理“签名”卡以外的任何卡(请参阅在这里)。如果您不介意为此做一些小腿工作,我不明白为什么您不能分配此存储库,并以支持类似标志实现的英雄卡的功能来构建。

我想这看起来像这样:

case 'application/vnd.microsoft.card.hero':
  // eslint-disable-next-line no-case-declarations
  const hero = attachment.content;

  message.body = `${ hero.text }\n\n`;
  message.body += (hero.buttons[0].title ? `*${ hero.buttons[0].title }*\n` : '');
  message.body += hero.buttons[0].value;
  break;

以上可能需要一些按摩,但离这个还不远。然后,您只需要构建库以供使用。

It looks like you are using the TwilioWhatsAppAdapter from the botbuilder-community-js repo.

Looking at the adapter's code, it doesn't appear to be configured to handle any card other than a 'signin' card (see here). If you don't mind doing a little leg work on this, I don't see why you couldn't fork this repo and build in functionality that supports a hero card similar to the signin implementation.

I imagine it would look something like this:

case 'application/vnd.microsoft.card.hero':
  // eslint-disable-next-line no-case-declarations
  const hero = attachment.content;

  message.body = `${ hero.text }\n\n`;
  message.body += (hero.buttons[0].title ? `*${ hero.buttons[0].title }*\n` : '');
  message.body += hero.buttons[0].value;
  break;

The above may need a little massaging but it wouldn't be far off from this. Then, you just need to build the library for use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文