github.com/twilio/twilio-go@v1.20.1/rest/chat/v2/docs/ServicesChannelsMessagesApi.md (about) 1 # ServicesChannelsMessagesApi 2 3 All URIs are relative to *https://chat.twilio.com* 4 5 Method | HTTP request | Description 6 ------------- | ------------- | ------------- 7 [**CreateMessage**](ServicesChannelsMessagesApi.md#CreateMessage) | **Post** /v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages | 8 [**DeleteMessage**](ServicesChannelsMessagesApi.md#DeleteMessage) | **Delete** /v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid} | 9 [**FetchMessage**](ServicesChannelsMessagesApi.md#FetchMessage) | **Get** /v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid} | 10 [**ListMessage**](ServicesChannelsMessagesApi.md#ListMessage) | **Get** /v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages | 11 [**UpdateMessage**](ServicesChannelsMessagesApi.md#UpdateMessage) | **Post** /v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages/{Sid} | 12 13 14 15 ## CreateMessage 16 17 > ChatV2Message CreateMessage(ctx, ServiceSidChannelSidoptional) 18 19 20 21 22 23 ### Path Parameters 24 25 26 Name | Type | Description 27 ------------- | ------------- | ------------- 28 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 29 **ServiceSid** | **string** | The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to create the Message resource under. 30 **ChannelSid** | **string** | The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the new Message resource belongs to. This value can be the Channel resource's `sid` or `unique_name`. 31 32 ### Other Parameters 33 34 Other parameters are passed through a pointer to a CreateMessageParams struct 35 36 37 Name | Type | Description 38 ------------- | ------------- | ------------- 39 **XTwilioWebhookEnabled** | **string** | The X-Twilio-Webhook-Enabled HTTP request header 40 **From** | **string** | The [Identity](https://www.twilio.com/docs/chat/identity) of the new message's author. The default value is `system`. 41 **Attributes** | **string** | A valid JSON string that contains application-specific data. 42 **DateCreated** | **time.Time** | The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value 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. 43 **DateUpdated** | **time.Time** | The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. 44 **LastUpdatedBy** | **string** | The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. 45 **Body** | **string** | The message to send to the channel. Can 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. 46 **MediaSid** | **string** | The SID of the [Media](https://www.twilio.com/docs/chat/rest/media) to attach to the new Message. 47 48 ### Return type 49 50 [**ChatV2Message**](ChatV2Message.md) 51 52 ### Authorization 53 54 [accountSid_authToken](../README.md#accountSid_authToken) 55 56 ### HTTP request headers 57 58 - **Content-Type**: application/x-www-form-urlencoded 59 - **Accept**: application/json 60 61 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 62 [[Back to Model list]](../README.md#documentation-for-models) 63 [[Back to README]](../README.md) 64 65 66 ## DeleteMessage 67 68 > DeleteMessage(ctx, ServiceSidChannelSidSidoptional) 69 70 71 72 73 74 ### Path Parameters 75 76 77 Name | Type | Description 78 ------------- | ------------- | ------------- 79 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 80 **ServiceSid** | **string** | The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to delete the Message resource from. 81 **ChannelSid** | **string** | The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource to delete belongs to. This value can be the Channel resource's `sid` or `unique_name`. 82 **Sid** | **string** | The SID of the Message resource to delete. 83 84 ### Other Parameters 85 86 Other parameters are passed through a pointer to a DeleteMessageParams struct 87 88 89 Name | Type | Description 90 ------------- | ------------- | ------------- 91 **XTwilioWebhookEnabled** | **string** | The X-Twilio-Webhook-Enabled HTTP request header 92 93 ### Return type 94 95 (empty response body) 96 97 ### Authorization 98 99 [accountSid_authToken](../README.md#accountSid_authToken) 100 101 ### HTTP request headers 102 103 - **Content-Type**: Not defined 104 - **Accept**: Not defined 105 106 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 107 [[Back to Model list]](../README.md#documentation-for-models) 108 [[Back to README]](../README.md) 109 110 111 ## FetchMessage 112 113 > ChatV2Message FetchMessage(ctx, ServiceSidChannelSidSid) 114 115 116 117 118 119 ### Path Parameters 120 121 122 Name | Type | Description 123 ------------- | ------------- | ------------- 124 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 125 **ServiceSid** | **string** | The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the Message resource from. 126 **ChannelSid** | **string** | The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource to fetch belongs to. This value can be the Channel resource's `sid` or `unique_name`. 127 **Sid** | **string** | The SID of the Message resource to fetch. 128 129 ### Other Parameters 130 131 Other parameters are passed through a pointer to a FetchMessageParams struct 132 133 134 Name | Type | Description 135 ------------- | ------------- | ------------- 136 137 ### Return type 138 139 [**ChatV2Message**](ChatV2Message.md) 140 141 ### Authorization 142 143 [accountSid_authToken](../README.md#accountSid_authToken) 144 145 ### HTTP request headers 146 147 - **Content-Type**: Not defined 148 - **Accept**: application/json 149 150 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 151 [[Back to Model list]](../README.md#documentation-for-models) 152 [[Back to README]](../README.md) 153 154 155 ## ListMessage 156 157 > []ChatV2Message ListMessage(ctx, ServiceSidChannelSidoptional) 158 159 160 161 162 163 ### Path Parameters 164 165 166 Name | Type | Description 167 ------------- | ------------- | ------------- 168 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 169 **ServiceSid** | **string** | The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the Message resources from. 170 **ChannelSid** | **string** | The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource to read belongs to. This value can be the Channel resource's `sid` or `unique_name`. 171 172 ### Other Parameters 173 174 Other parameters are passed through a pointer to a ListMessageParams struct 175 176 177 Name | Type | Description 178 ------------- | ------------- | ------------- 179 **Order** | **string** | The sort order of the returned messages. Can be: `asc` (ascending) or `desc` (descending) with `asc` as the default. 180 **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. 181 **Limit** | **int** | Max number of records to return. 182 183 ### Return type 184 185 [**[]ChatV2Message**](ChatV2Message.md) 186 187 ### Authorization 188 189 [accountSid_authToken](../README.md#accountSid_authToken) 190 191 ### HTTP request headers 192 193 - **Content-Type**: Not defined 194 - **Accept**: application/json 195 196 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 197 [[Back to Model list]](../README.md#documentation-for-models) 198 [[Back to README]](../README.md) 199 200 201 ## UpdateMessage 202 203 > ChatV2Message UpdateMessage(ctx, ServiceSidChannelSidSidoptional) 204 205 206 207 208 209 ### Path Parameters 210 211 212 Name | Type | Description 213 ------------- | ------------- | ------------- 214 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 215 **ServiceSid** | **string** | The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to update the Message resource in. 216 **ChannelSid** | **string** | The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Message resource to update belongs to. This value can be the Channel resource's `sid` or `unique_name`. 217 **Sid** | **string** | The SID of the Message resource to update. 218 219 ### Other Parameters 220 221 Other parameters are passed through a pointer to a UpdateMessageParams struct 222 223 224 Name | Type | Description 225 ------------- | ------------- | ------------- 226 **XTwilioWebhookEnabled** | **string** | The X-Twilio-Webhook-Enabled HTTP request header 227 **Body** | **string** | The message to send to the channel. Can 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. 228 **Attributes** | **string** | A valid JSON string that contains application-specific data. 229 **DateCreated** | **time.Time** | The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was created. The default value 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. 230 **DateUpdated** | **time.Time** | The date, specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format, to assign to the resource as the date it was last updated. 231 **LastUpdatedBy** | **string** | The [Identity](https://www.twilio.com/docs/chat/identity) of the User who last updated the Message, if applicable. 232 **From** | **string** | The [Identity](https://www.twilio.com/docs/chat/identity) of the message's author. 233 234 ### Return type 235 236 [**ChatV2Message**](ChatV2Message.md) 237 238 ### Authorization 239 240 [accountSid_authToken](../README.md#accountSid_authToken) 241 242 ### HTTP request headers 243 244 - **Content-Type**: application/x-www-form-urlencoded 245 - **Accept**: application/json 246 247 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 248 [[Back to Model list]](../README.md#documentation-for-models) 249 [[Back to README]](../README.md) 250