Twilio programmable chat messages with media and custom attributes

Viewed 2018

I'm wondering if I can attach media to a Twilio Chat message. I'm a bit confused with Twilio docs on this:

  1. The Help Center's Programmable Chat file support for sending messages says it's not supported.
    Looks like this is outdated?
  2. The Programmable Chat's API Reference, "Channels and Messages" section says:

    Today, a message is just a string of text. In the future, this may expand to include other media types, like images and binary data.

    Also outdated?

  3. This StackOverflow answer says it's possible to send multimedia messages, at least for JavaScript. Looks like the same is possible for iOS with the TCHMessageOptions's withMediaStream:contentType:defaultFilename:onStarted:onProgress:onCompleted: method.
  4. [Aside question] Using the method above, looks like I can create a multimedia message, but can I also set custom attributes?

Could you please clarify?

Thank you!

1 Answers

Twilio developer evangelist here.

Attaching media to messages in Twilio Programmable Chat is now supported in beta. It seems that some of the documentation is a little outdated, but the page with the code and explanations you are looking for is here: https://www.twilio.com/docs/api/chat/guides/media-support.

As for sending custom attributes, each message has an attributes property that you can use to send arbitrary JSON.

I'm working to correct the misleading documentation now. Thanks for pointing it out!

Related