All URIs are relative to https://api.twilio.com
Method | HTTP request | Description |
---|---|---|
CreateMessage | Post /2010-04-01/Accounts/{AccountSid}/Messages.json | |
DeleteMessage | Delete /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json | |
FetchMessage | Get /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json | |
ListMessage | Get /2010-04-01/Accounts/{AccountSid}/Messages.json | |
UpdateMessage | Post /2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json |
ApiV2010Message CreateMessage(ctx, optional)
Send a message from the account used to make the request
This endpoint does not need any path parameter.
Other parameters are passed through a pointer to a CreateMessageParams struct
Name | Type | Description |
---|---|---|
PathAccountSid | string | The SID of the Account that will create the resource. |
To | string | The destination phone number in E.164 format for SMS/MMS or Channel user address for other 3rd-party channels. |
StatusCallback | string | The URL we should call using the status_callback_method to send status information to your application. If specified, we POST these message status changes to the URL: queued , failed , sent , delivered , or undelivered . Twilio will POST its standard request parameters as well as some additional parameters including MessageSid , MessageStatus , and ErrorCode . If you include this parameter with the messaging_service_sid , we use this URL instead of the Status Callback URL of the Messaging Service. URLs must contain a valid hostname and underscores are not allowed. |
ApplicationSid | string | The SID of the application that should receive message status. We POST a message_sid parameter and a message_status parameter with a value of sent or failed to the application's message_status_callback . If a status_callback parameter is also passed, it will be ignored and the application's message_status_callback parameter will be used. |
MaxPrice | float32 | The maximum total price in US dollars that you will pay for the message to be delivered. Can be a decimal value that has up to 4 decimal places. All messages are queued for delivery and the message cost is checked before the message is sent. If the cost exceeds max_price , the message will fail and a status of Failed is sent to the status callback. If MaxPrice is not set, the message cost is not checked. |
ProvideFeedback | bool | Whether to confirm delivery of the message. Set this value to true if you are sending messages that have a trackable user action and you intend to confirm delivery of the message using the Message Feedback API. This parameter is false by default. |
Attempt | int | Total number of attempts made ( including this ) to send out the message regardless of the provider used |
ValidityPeriod | int | How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds. |
ForceDelivery | bool | Reserved |
ContentRetention | string | |
AddressRetention | string | |
SmartEncoded | bool | Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: true or false . |
PersistentAction | []string | Rich actions for Channels Messages. |
ShortenUrls | bool | Determines the usage of Click Tracking. Setting it to true will instruct Twilio to replace all links in the Message with a shortened version based on the associated Domain Sid and track clicks on them. If this parameter is not set on an API call, we will use the value set on the Messaging Service. If this parameter is not set and the value is not configured on the Messaging Service used this will default to false . |
ScheduleType | string | |
SendAt | time.Time | The time that Twilio will send the message. Must be in ISO 8601 format. |
SendAsMms | bool | If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media. |
ContentSid | string | The SID of the Content object returned at Content API content create time (https://www.twilio.com/docs/content-api/create-and-send-your-first-content-api-template#create-a-template). If this parameter is not specified, then the Content API will not be utilized. |
ContentVariables | string | Key-value pairs of variable names to substitution values, used alongside a content_sid. If not specified, Content API will default to the default variables defined at create time. |
From | string | A Twilio phone number in E.164 format, an alphanumeric sender ID, or a Channel Endpoint address that is enabled for the type of message you want to send. Phone numbers or short codes purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using messaging_service_sid , this parameter must be empty. |
MessagingServiceSid | string | The SID of the Messaging Service you want to associate with the Message. Set this parameter to use the Messaging Service Settings and Copilot Features you have configured and leave the from parameter empty. When only this parameter is set, Twilio will use your enabled Copilot Features to select the from phone number for delivery. |
Body | string | The text of the message you want to send. Can be up to 1,600 characters in length. |
MediaUrl | []string | The URL of the media to send with the message. The media can be of type gif , png , and jpeg and will be formatted correctly on the recipient's device. The media size limit is 5MB for supported file types (JPEG, PNG, GIF) and 500KB for other types of accepted media. To send more than one image in the message body, provide multiple media_url parameters in the POST request. You can include up to 10 media_url parameters per message. You can send images in an SMS message in only the US and Canada. |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteMessage(ctx, Sidoptional)
Deletes a message record from your account
Name | Type | Description |
---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. |
Sid | string | The Twilio-provided string that uniquely identifies the Message resource to delete. |
Other parameters are passed through a pointer to a DeleteMessageParams struct
Name | Type | Description |
---|---|---|
PathAccountSid | string | The SID of the Account that created the Message resources to delete. |
(empty response body)
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiV2010Message FetchMessage(ctx, Sidoptional)
Fetch a message belonging to the account used to make the request
Name | Type | Description |
---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. |
Sid | string | The Twilio-provided string that uniquely identifies the Message resource to fetch. |
Other parameters are passed through a pointer to a FetchMessageParams struct
Name | Type | Description |
---|---|---|
PathAccountSid | string | The SID of the Account that created the Message resource to fetch. |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
[]ApiV2010Message ListMessage(ctx, optional)
Retrieve a list of messages belonging to the account used to make the request
This endpoint does not need any path parameter.
Other parameters are passed through a pointer to a ListMessageParams struct
Name | Type | Description |
---|---|---|
PathAccountSid | string | The SID of the Account that created the Message resources to read. |
To | string | Read messages sent to only this phone number. |
From | string | Read messages sent from only this phone number or alphanumeric sender ID. |
DateSent | time.Time | The date of the messages to show. Specify a date as YYYY-MM-DD in GMT to read only messages sent on this date. For example: 2009-07-06 . You can also specify an inequality, such as DateSent<=YYYY-MM-DD , to read messages sent on or before midnight on a date, and DateSent>=YYYY-MM-DD to read messages sent on or after midnight on a date. |
DateSentBefore | time.Time | The date of the messages to show. Specify a date as YYYY-MM-DD in GMT to read only messages sent on this date. For example: 2009-07-06 . You can also specify an inequality, such as DateSent<=YYYY-MM-DD , to read messages sent on or before midnight on a date, and DateSent>=YYYY-MM-DD to read messages sent on or after midnight on a date. |
DateSentAfter | time.Time | The date of the messages to show. Specify a date as YYYY-MM-DD in GMT to read only messages sent on this date. For example: 2009-07-06 . You can also specify an inequality, such as DateSent<=YYYY-MM-DD , to read messages sent on or before midnight on a date, and DateSent>=YYYY-MM-DD to read messages sent on or after midnight on a date. |
PageSize | int | How many resources to return in each list page. The default is 50, and the maximum is 1000. |
Limit | int | Max number of records to return. |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ApiV2010Message UpdateMessage(ctx, Sidoptional)
To redact a message-body from a post-flight message record, post to the message instance resource with an empty body
Name | Type | Description |
---|---|---|
ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. |
Sid | string | The Twilio-provided string that uniquely identifies the Message resource to update. |
Other parameters are passed through a pointer to a UpdateMessageParams struct
Name | Type | Description |
---|---|---|
PathAccountSid | string | The SID of the Account that created the Message resources to update. |
Body | string | The text of the message you want to send. Can be up to 1,600 characters long. |
Status | string |
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]