TVOCallMessage
Objective-C
@interface TVOCallMessage : NSObject
Swift
class TVOCallMessage : NSObject
@brief TVOCallMessage represents the in-call message and its configuration.
@discussion Message builder to use when using the [TVOCall sendMessage:] method. Example:
let messageContent = "{\"foo\": \"bar\"}"
let callMessage = CallMessage(content: messageContent, messageType: "user-defined-message")
let voiceEventSid = call.sendMessage(callMessage)
-
@brief The type for the message. The SDK does not validate the value and treats it as a pass-through for both inbound and outbound call messages. To send a user defined message with the
[TVOCall sendMessage:]method, set themessageTypetouser-defined-message.Declaration
Objective-C
@property (nonatomic, copy, readonly, nonnull) NSString *messageType;Swift
var messageType: String { get } -
@brief The MIME type for the message.
@discussion Currently the only supported type is “application/json”, which is also the default value.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *contentType;Swift
var contentType: String? { get } -
@brief The content body of the message.
@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.@discussion 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.Declaration
Objective-C
@property (nonatomic, copy, readonly, nonnull) NSString *content;Swift
var content: String { get } -
@brief The unique identifier of the message.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nonnull) NSString *voiceEventSid;Swift
var voiceEventSid: String { get } -
Unavailable
Use the
TVOCallMessageinitializer instead.@brief Developers shouldn’t initialize this class directly.
@discussion Use the
TVOCallMessagebuilder method instead.Declaration
Objective-C
- (null_unspecified instancetype)init; -
Deprecated
Will not be supported in TwilioVoice v6.12+
@brief Creates
TVOCallMessagewith the message content.@discussion Default value
application/jsonwill be used ascontentType.Declaration
Objective-C
+ (nonnull instancetype)messageWithContent:(nonnull NSString *)content;Swift
convenience init(content: String)Parameters
contentThe message content.
Return Value
An instance of
TVOCallMessage. -
@brief Creates
TVOCallMessagewith the message content and message type.@discussion The SDK does not validate the value and treats it as a pass-through for both inbound and outbound call messages. To send a user defined message with the
[TVOCall sendMessage:]method, set themessageTypetouser-defined-message. @discussion Default valueapplication/jsonwill be used ascontentTypeif not explicitly specified in thebuilderBlock.Declaration
Objective-C
+ (nonnull instancetype)messageWithContent:(nonnull NSString *)content messageType:(nonnull NSString *)messageType block:(nullable TVOCallMessageBuilderBlock) builderBlock;Swift
convenience init(content: String, messageType: String, block builderBlock: TVOCallMessageBuilderBlock? = nil)Parameters
contentThe message content.
messageTypeThe message type.
builderBlockThe
TVOCallMessageBuilderBlockbuilder.Return Value
An instance of
TVOCallMessage.