使用 twilio 和 node js 通过 whatsapp 发送订单详细信息

问题描述

我想使用 twilio 和 node js 通过 WhatsApp 消息发送订单详细信息。我可以将订单详细信息发送到我添加到沙箱中的号码。如果我想向用户号码发送订单详细信息,则消息失败。怎么做?请帮帮我

import twilio from 'twilio';

export const sendOrder = async (order) => {
const accountSid = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';

const client = new twilio(accountSid,authToken);
await client.messages
  .create({
     from: 'whatsapp:+14155238886',to: `whatsapp:+91${order.shippingAddress.phone}`,body: 'Order Amount...' + order.totalPrice,})
  .then((message) => console.log(message.sid));
};

解决方法

您尝试向您的 Sandbox 成员发送 WhatsApp 消息的一方是否(他们是否发送了诸如 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\unordered_map(133): error C2535: 'std::unordered_map<std::string,double,std::less<std::string>,std::allocator<std::pair<const std::string,double>>,double>>>::unordered_map(unsigned __int64,const std::less<std::string> &,const std::allocator<std::pair<const std::string,double>> &)': member function already defined or declared C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\unordered_map(128): note: see declaration of 'std::unordered_map<std::string,double>>>::unordered_map' D:\LearnSwig\cmake-build-release-visual-studio\src\UsingUnorderedMap\CMakeFiles\UsingUnorderedMap.dir\UsingUnorderedMapPYTHON_wrap.cxx(5059): note: see reference to class template instantiation 'std::unordered_map<std::string,double>>>' being compiled ... 之类的消息)?

您是否使用其中一个沙盒示例模板向他们发送第一条消息?您必须在启动出站 WhatsApp 消息时使用模板,直到他们响应,更多详情here

您可以检查 Twilio debugger 或 API 响应是否有错误。