github.com/twilio/twilio-go@v1.20.1/rest/api/v2010/docs/AccountsMessagesApi.md (about) 1 # AccountsMessagesApi 2 3 All URIs are relative to *https://api.twilio.com* 4 5 Method | HTTP request | Description 6 ------------- | ------------- | ------------- 7 [**CreateMessage**](AccountsMessagesApi.md#CreateMessage) | **Post** /2010-04-01/Accounts/{AccountSid}/Messages.json | 8 [**DeleteMessage**](AccountsMessagesApi.md#DeleteMessage) | **Delete** /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json | 9 [**FetchMessage**](AccountsMessagesApi.md#FetchMessage) | **Get** /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json | 10 [**ListMessage**](AccountsMessagesApi.md#ListMessage) | **Get** /2010-04-01/Accounts/{AccountSid}/Messages.json | 11 [**UpdateMessage**](AccountsMessagesApi.md#UpdateMessage) | **Post** /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json | 12 13 14 15 ## CreateMessage 16 17 > ApiV2010Message CreateMessage(ctx, optional) 18 19 20 21 Send a message 22 23 ### Path Parameters 24 25 This endpoint does not need any path parameter. 26 27 ### Other Parameters 28 29 Other parameters are passed through a pointer to a CreateMessageParams struct 30 31 32 Name | Type | Description 33 ------------- | ------------- | ------------- 34 **PathAccountSid** | **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) creating the Message resource. 35 **To** | **string** | The recipient's phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format (for SMS/MMS) or [channel address](https://www.twilio.com/docs/messaging/channels), e.g. `whatsapp:+15552229999`. 36 **StatusCallback** | **string** | The URL of the endpoint to which Twilio sends [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url). URL must contain a valid hostname and underscores are not allowed. If you include this parameter with the `messaging_service_sid`, Twilio uses this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource). 37 **ApplicationSid** | **string** | The SID of the associated [TwiML Application](https://www.twilio.com/docs/usage/api/applications). [Message status callback requests](https://www.twilio.com/docs/sms/api/message-resource#twilios-request-to-the-statuscallback-url) are sent to the TwiML App's `message_status_callback` URL. Note that the `status_callback` parameter of a request takes priority over the `application_sid` parameter; if both are included `application_sid` is ignored. 38 **MaxPrice** | **float32** | [DEPRECATED] This parameter will no longer have any effect as of 2024-06-03. 39 **ProvideFeedback** | **bool** | Boolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the [Message Feedback subresource](https://www.twilio.com/docs/sms/api/message-feedback-resource)). Default value is `false`. 40 **Attempt** | **int** | Total number of attempts made (including this request) to send the message regardless of the provider used 41 **ValidityPeriod** | **int** | The maximum length in seconds that the Message can remain in Twilio's outgoing message queue. If a queued Message exceeds the `validity_period`, the Message is not sent. Accepted values are integers from `1` to `14400`. Default value is `14400`. A `validity_period` greater than `5` is recommended. [Learn more about the validity period](https://www.twilio.com/blog/take-more-control-of-outbound-messages-using-validity-period-html) 42 **ForceDelivery** | **bool** | Reserved 43 **ContentRetention** | **string** | 44 **AddressRetention** | **string** | 45 **SmartEncoded** | **bool** | Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: `true` or `false`. 46 **PersistentAction** | **[]string** | Rich actions for non-SMS/MMS channels. Used for [sending location in WhatsApp messages](https://www.twilio.com/docs/whatsapp/message-features#location-messages-with-whatsapp). 47 **ShortenUrls** | **bool** | For Messaging Services with [Link Shortening configured](https://www.twilio.com/docs/messaging/features/link-shortening) only: A Boolean indicating whether or not Twilio should shorten links in the `body` of the Message. Default value is `false`. If `true`, the `messaging_service_sid` parameter must also be provided. 48 **ScheduleType** | **string** | 49 **SendAt** | **time.Time** | The time that Twilio will send the message. Must be in ISO 8601 format. 50 **SendAsMms** | **bool** | If set to `true`, Twilio delivers the message as a single MMS message, regardless of the presence of media. 51 **ContentVariables** | **string** | For [Content Editor/API](https://www.twilio.com/docs/content) only: Key-value pairs of [Template variables](https://www.twilio.com/docs/content/using-variables-with-content-api) and their substitution values. `content_sid` parameter must also be provided. If values are not defined in the `content_variables` parameter, the [Template's default placeholder values](https://www.twilio.com/docs/content/content-api-resources#create-templates) are used. 52 **RiskCheck** | **string** | 53 **From** | **string** | The sender's Twilio phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). The value of the `from` parameter must be a sender that is hosted within Twilio and belongs to the Account creating the Message. If you are using `messaging_service_sid`, this parameter can be empty (Twilio assigns a `from` value from the Messaging Service's Sender Pool) or you can provide a specific sender from your Sender Pool. 54 **MessagingServiceSid** | **string** | The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/services) you want to associate with the Message. When this parameter is provided and the `from` parameter is omitted, Twilio selects the optimal sender from the Messaging Service's Sender Pool. You may also provide a `from` parameter if you want to use a specific Sender from the Sender Pool. 55 **Body** | **string** | The text content of the outgoing message. Can be up to 1,600 characters in length. SMS only: If the `body` contains more than 160 [GSM-7](https://www.twilio.com/docs/glossary/what-is-gsm-7-character-encoding) characters (or 70 [UCS-2](https://www.twilio.com/docs/glossary/what-is-ucs-2-character-encoding) characters), the message is segmented and charged accordingly. For long `body` text, consider using the [send_as_mms parameter](https://www.twilio.com/blog/mms-for-long-text-messages). 56 **MediaUrl** | **[]string** | The URL of media to include in the Message content. `jpeg`, `jpg`, `gif`, and `png` file types are fully supported by Twilio and content is formatted for delivery on destination devices. The media size limit is 5 MB for supported file types (`jpeg`, `jpg`, `png`, `gif`) and 500 KB for [other types](https://www.twilio.com/docs/messaging/guides/accepted-mime-types) of accepted media. To send more than one image in the message, provide multiple `media_url` parameters in the POST request. You can include up to ten `media_url` parameters per message. [International](https://support.twilio.com/hc/en-us/articles/223179808-Sending-and-receiving-MMS-messages) and [carrier](https://support.twilio.com/hc/en-us/articles/223133707-Is-MMS-supported-for-all-carriers-in-US-and-Canada-) limits apply. 57 **ContentSid** | **string** | For [Content Editor/API](https://www.twilio.com/docs/content) only: The SID of the Content Template to be used with the Message, e.g., `HXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`. If this parameter is not provided, a Content Template is not used. Find the SID in the Console on the Content Editor page. For Content API users, the SID is found in Twilio's response when [creating the Template](https://www.twilio.com/docs/content/content-api-resources#create-templates) or by [fetching your Templates](https://www.twilio.com/docs/content/content-api-resources#fetch-all-content-resources). 58 59 ### Return type 60 61 [**ApiV2010Message**](ApiV2010Message.md) 62 63 ### Authorization 64 65 [accountSid_authToken](../README.md#accountSid_authToken) 66 67 ### HTTP request headers 68 69 - **Content-Type**: application/x-www-form-urlencoded 70 - **Accept**: application/json 71 72 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 73 [[Back to Model list]](../README.md#documentation-for-models) 74 [[Back to README]](../README.md) 75 76 77 ## DeleteMessage 78 79 > DeleteMessage(ctx, Sidoptional) 80 81 82 83 Deletes a Message resource from your account 84 85 ### Path Parameters 86 87 88 Name | Type | Description 89 ------------- | ------------- | ------------- 90 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 91 **Sid** | **string** | The SID of the Message resource you wish to delete 92 93 ### Other Parameters 94 95 Other parameters are passed through a pointer to a DeleteMessageParams struct 96 97 98 Name | Type | Description 99 ------------- | ------------- | ------------- 100 **PathAccountSid** | **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource 101 102 ### Return type 103 104 (empty response body) 105 106 ### Authorization 107 108 [accountSid_authToken](../README.md#accountSid_authToken) 109 110 ### HTTP request headers 111 112 - **Content-Type**: Not defined 113 - **Accept**: Not defined 114 115 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 116 [[Back to Model list]](../README.md#documentation-for-models) 117 [[Back to README]](../README.md) 118 119 120 ## FetchMessage 121 122 > ApiV2010Message FetchMessage(ctx, Sidoptional) 123 124 125 126 Fetch a specific Message 127 128 ### Path Parameters 129 130 131 Name | Type | Description 132 ------------- | ------------- | ------------- 133 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 134 **Sid** | **string** | The SID of the Message resource to be fetched 135 136 ### Other Parameters 137 138 Other parameters are passed through a pointer to a FetchMessageParams struct 139 140 141 Name | Type | Description 142 ------------- | ------------- | ------------- 143 **PathAccountSid** | **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource 144 145 ### Return type 146 147 [**ApiV2010Message**](ApiV2010Message.md) 148 149 ### Authorization 150 151 [accountSid_authToken](../README.md#accountSid_authToken) 152 153 ### HTTP request headers 154 155 - **Content-Type**: Not defined 156 - **Accept**: application/json 157 158 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 159 [[Back to Model list]](../README.md#documentation-for-models) 160 [[Back to README]](../README.md) 161 162 163 ## ListMessage 164 165 > []ApiV2010Message ListMessage(ctx, optional) 166 167 168 169 Retrieve a list of Message resources associated with a Twilio Account 170 171 ### Path Parameters 172 173 This endpoint does not need any path parameter. 174 175 ### Other Parameters 176 177 Other parameters are passed through a pointer to a ListMessageParams struct 178 179 180 Name | Type | Description 181 ------------- | ------------- | ------------- 182 **PathAccountSid** | **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resources. 183 **To** | **string** | Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` 184 **From** | **string** | Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` 185 **DateSent** | **time.Time** | Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). 186 **DateSentBefore** | **time.Time** | Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). 187 **DateSentAfter** | **time.Time** | Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). 188 **PageSize** | **int** | How many resources to return in each list page. The default is 50, and the maximum is 1000. 189 **Limit** | **int** | Max number of records to return. 190 191 ### Return type 192 193 [**[]ApiV2010Message**](ApiV2010Message.md) 194 195 ### Authorization 196 197 [accountSid_authToken](../README.md#accountSid_authToken) 198 199 ### HTTP request headers 200 201 - **Content-Type**: Not defined 202 - **Accept**: application/json 203 204 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 205 [[Back to Model list]](../README.md#documentation-for-models) 206 [[Back to README]](../README.md) 207 208 209 ## UpdateMessage 210 211 > ApiV2010Message UpdateMessage(ctx, Sidoptional) 212 213 214 215 Update a Message resource (used to redact Message `body` text and to cancel not-yet-sent messages) 216 217 ### Path Parameters 218 219 220 Name | Type | Description 221 ------------- | ------------- | ------------- 222 **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. 223 **Sid** | **string** | The SID of the Message resource to be updated 224 225 ### Other Parameters 226 227 Other parameters are passed through a pointer to a UpdateMessageParams struct 228 229 230 Name | Type | Description 231 ------------- | ------------- | ------------- 232 **PathAccountSid** | **string** | The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Message resources to update. 233 **Body** | **string** | The new `body` of the Message resource. To redact the text content of a Message, this parameter's value must be an empty string 234 **Status** | **string** | 235 236 ### Return type 237 238 [**ApiV2010Message**](ApiV2010Message.md) 239 240 ### Authorization 241 242 [accountSid_authToken](../README.md#accountSid_authToken) 243 244 ### HTTP request headers 245 246 - **Content-Type**: application/x-www-form-urlencoded 247 - **Accept**: application/json 248 249 [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) 250 [[Back to Model list]](../README.md#documentation-for-models) 251 [[Back to README]](../README.md) 252