javascripttwilio-apitwilio-conversations

How can I send shortened links using Twilio Conversation API


Twilio has a Link Shortening service, but it seems like it's only available for the Programmable Messaging API, here's what it's like to create a Message and enable Link Shortening using the Messaging API:

// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at 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: 'Hello there. Check out our holiday promotion here: https://www.acme.com/holiday_promotion',
     messagingServiceSid: 'MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
     shortenUrls: true,
     to: '+11234567890'
   })
  .then(message => console.log(message.sid));

And here's how you usually create a Conversation Message:

// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at 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.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
                       .messages
                       .create({author: 'smee', body: 'Ahoy there!'})
                       .then(message => console.log(message.sid));

Is there a way to use it with Conversations API?


Solution

  • I'm afraid this is, as of now, not possible.