メニュー

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

メッセージリソース

Programmable ChatのMessageリソースは、サービスインスタンスにおけるチャネル内の単一のメッセージを表します。チャネルのMessagesリソースにPOSTすると、REST API経由でチャネルにメッセージを送信できます。

プロパティ

各メッセージに次のプロパティがあります。

Names in PHP format
sid
sid<IM> Not PII

The unique string that we created to identify the Message resource.

accountSid
sid<AC> Not PII

The SID of the Account that created the Message resource.

attributes
文字列 PII MTL: 120 DAYS

The JSON string that stores application-specific data. Note If this property has been assigned a value, it's only displayed in a FETCH action that returns a single resource; otherwise, it's null. If the attributes have not been set, {} is returned.

serviceSid
sid<IS> Not PII

The SID of the Service the resource is associated with.

to
sid<CH> Not PII

The SID of the Channel that the message was sent to.

channelSid
sid<CH> Not PII

The unique ID of the Channel the Message resource belongs to.

dateCreated
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in RFC 2822 format.

dateUpdated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in RFC 2822 format.

lastUpdatedBy
文字列 PII MTL: 120 DAYS

The Identity of the User who last updated the Message if relevant.

wasEdited
boolean Not PII

Whether the message has been edited since it was created.

from
文字列 PII MTL: 120 DAYS

The identity of the message's author. The default value is system.

body
文字列 PII MTL: 120 DAYS

The content of the message.

index
integer Not PII

The index of the message within the Channel.

type
文字列 Not PII

The Message type. Can be: text or media.

media
オブジェクト Not PII

A Media object that describes the Message's media if attached. A Media object contains these fields: 'content_typewith the MIME type of the media,filenamewith the name of the media,sidwith the SID of the Media resource, andsizewith the media object's file size in bytes. If the Message has no media, this value isnull`.

url
url Not PII

The absolute URL of the Message resource.

Media resource object properties:

name description
sid このリソースを一意に識別する 34 文字の文字列です。
content_type MIME content type which reflects uploaded file type. For example: video/mp4, image/jpeg, etc.
filename Optional — provided filename for the file uploaded. May be null.
Size Uploaded file size in bytes

チャンネルのすべてのメッセージをリストにする

GET /Services/{Service SID}/Channels/{Channel SID}/Messages

パラメーター

Names in PHP format
serviceSid
必須
GET sid<IS> Not PII

The SID of the Service to read the resources from.

channelSid
必須
GET sid_like<CH> Not PII

The unique ID of the Channel the message to read belongs to. Can be the Channel's sid or unique_name.

order
オプション
GET enum:order_type Not PII

The sort order of the returned messages. Can be: asc (ascending) or desc (descending) with asc as the default.

        
        
        
        

        チャンネルにメッセージを送信する

        POST /Services/{Service SID}/Channels/{Channel SID}/Messages
        

        パラメーター

        Names in PHP format
        serviceSid
        必須
        post sid<IS> Not PII

        The SID of the Service to create the resource under.

        channelSid
        必須
        post sid_like<CH> Not PII

        The unique ID of the Channel the new resource belongs to. Can be the Channel resource's sid or unique_name.

        from
        オプション
        post 文字列 PII MTL: 120 DAYS

        The identity of the new message's author. The default value is system.

        attributes
        オプション
        post 文字列 PII MTL: 120 DAYS

        A valid JSON string that contains application-specific data.

        dateCreated
        オプション
        post date_time<iso8601> Not PII

        The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source.

        dateUpdated
        オプション
        post date_time<iso8601> Not PII

        The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated. The default value is null. Note that this parameter should only be used when a Chat's history is being recreated from a backup/separate source and where a Message was previously updated.

        lastUpdatedBy
        オプション
        post 文字列 PII MTL: 120 DAYS

        The identity of the User who last updated the Message, if applicable.

        body
        オプション
        post 文字列 PII MTL: 120 DAYS

        The message to send to the channel. Can also be an empty string or null, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.

        mediaSid
        オプション
        post sid<ME> Not PII

        The SID of the Media to attach to the new Message.

              
              
              
              

              チャンネルからメッセージを取得する

              GET /Services/{Service SID}/Channels/{Channel SID}/Messages/{Message SID}
              
                    
                    
                    
                    

                    既存のメッセージを更新する

                    POST /Services/{Service SID}/Channels/{Channel SID}/Messages/{Message SID}
                    

                    パラメーター

                    Names in PHP format
                    serviceSid
                    必須
                    post sid<IS> Not PII

                    The SID of the Service to update the resource from.

                    channelSid
                    必須
                    post sid_like<CH> Not PII

                    The unique ID of the Channel the message belongs to. Can be the Channel's sid or unique_name.

                    sid
                    必須
                    post sid<IM> Not PII

                    The Twilio-provided string that uniquely identifies the Message resource to update.

                    body
                    オプション
                    post 文字列 PII MTL: 120 DAYS

                    The message to send to the channel. Can also be an empty string or null, which sets the value as an empty string. You can send structured data in the body by serializing it as a string.

                    attributes
                    オプション
                    post 文字列 PII MTL: 120 DAYS

                    A valid JSON string that contains application-specific data.

                    dateCreated
                    オプション
                    post date_time<iso8601> Not PII

                    The date, specified in ISO 8601 format, to assign to the resource as the date it was created.

                    dateUpdated
                    オプション
                    post date_time<iso8601> Not PII

                    The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated.

                    lastUpdatedBy
                    オプション
                    post 文字列 PII MTL: 120 DAYS

                    The Identity of the User who last updated the Message, if applicable.

                    from
                    オプション
                    post 文字列 PII MTL: 120 DAYS

                    The Identity of the message's author.

                          
                          
                          
                          

                          チャンネルからメッセージを削除する

                          DELETE /Services/{Service SID}/Channels/{Channel SID}/Messages/{Message SID}
                          
                                
                                
                                
                                
                                Rate this page:

                                ヘルプが必要ですか?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.