如何在 node.js 中向 Twilio Conversation 发送新消息?
我从 Twilio 找到了这个示例代码,但我不知道如何获得messagingServiceSid
我的对话。
// Download the helper library from https://www.twilio.com/docs/node/install
// Your Account Sid and Auth Token from twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken);
client.messages
.create({
body: 'Revenge of the Sith was clearly the best of the prequel trilogy.',
messagingServiceSid: 'MG9752274e9e519418a7406176694466fa',
to: '+441632960675'
})
.then(message => console.log(message.sid));