TVOCallMessage Class Reference

Inherits from NSObject
Declared in TVOCallMessage.h

Overview

Message builder to use when using the [TVOCall sendMessage:] method. Example:

 let messageContent = "{\"foo\": \"bar\"}"
 let callMessage = CallMessage(content: messageContent)

 let voiceEventSid = call.sendMessage(callMessage)

  messageType

The type for the message.

@property (nonatomic, readonly, assign) TVOCallMessageType messageType

Declared In

TVOCallMessage.h

  contentType

The MIME type for the message.

@property (nonatomic, copy, readonly, nullable) NSString *contentType

Discussion

Currently the only supported type is “application/json”, which is also the default value.

Declared In

TVOCallMessage.h

  content

The content body of the message.

@property (nonatomic, copy, readonly, nonnull) NSString *content

Discussion

The format of the message body must match the content type. The size limit of the message content is 10 KB. [TVOCall sendMessage:] with message content that exceeds the size limitation will result in the [TVOCallMessageDelegate call:didFailToSendMessage:error] callback.

A call message with content that does not match the content type will not result in the [TVOCallMessageDelegate call:didFailToSendMessage:error] callback but will generate an error in your Twilio developer console. For example, a call message with content type “application/json” but with the content “Hello World”, which is not a valid JSON object, will result in such error.

Declared In

TVOCallMessage.h

  voiceEventSid

The unique identifier of the message.

@property (nonatomic, copy, readonly, nonnull) NSString *voiceEventSid

Declared In

TVOCallMessage.h

– init

Developers shouldn’t initialize this class directly.

- (null_unspecified instancetype)init

Discussion

Use the TVOCallMessage builder method instead.

Declared In

TVOCallMessage.h

+ messageWithContent:

Creates TVOCallMessage with the message content.

+ (nonnull instancetype)messageWithContent:(nonnull NSString *)content

Parameters

content

The message content.

Return Value

An instance of TVOCallMessage.

Discussion

Default values will be used for both the message type (TVOCallMessageUserDefinedMessage) and the content type (application/json).

Declared In

TVOCallMessage.h