首页 > 解决方案 > 基于 Twilio 云的函数和库

问题描述

@philnash 有一个[here][1]我尝试过但遇到问题的解决方案 - 我正在使用 Twilio 的云功能,并且在 client.messages 上没有智能感知 - 知道如何引用正确的库

client.messages.create({

在此处输入图像描述

在此处输入图像描述

标签: twilio

解决方案


在屏幕截图中,您拼写错误的客户,cleint.

exports.handler = function(context, event, callback) {
    const twilioClient = context.getTwilioClient();
    
twilioClient.messages
  .create({
    body: 'Hello World',
    to: '+14075551212',
    from: '+18025551212 ',
  }).then(message =>  {
        console.log('Created call using callback');
        console.log(message.sid);
        callback();
  })
    .catch(error => {
        console.log(error);
           callback("error");
    });
};

您还应该更新Twilio 客户端库版本,3.29.2 已经很老了。


推荐阅读