Twilio.Api.V2010.MessageService (twilio_elixir v0.1.1)

Copy Markdown View Source

A Message resource represents an inbound or outbound message.

Operations: list, create, fetch, update, delete

Summary

Functions

Deletes a Message resource from your account

Fetch a specific Message

Retrieve a list of Message resources associated with a Twilio Account

Stream: Retrieve a list of Message resources associated with a Twilio Account (lazy auto-pagination).

Update a Message resource (used to redact Message body text and to cancel not-yet-sent messages)

Functions

create(client, params \\ %{}, opts \\ [])

@spec create(Twilio.Client.t(), map(), keyword()) ::
  {:ok, Twilio.Resources.Api.V2010.Message.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}

Send a message

Operation: CreateMessage | Tags: Api20100401Message

Required Parameters

ParameterTypeDescription

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| To | string (phone-number) | The recipient's phone number in E.164 format (for SMS/MMS) or channel address, e.g. whatsapp:+15552229999. |

Optional Parameters

ParameterTypeDescription
AddressRetentionstringValues: retain, obfuscate

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| ApplicationSid | string | The SID of the associated TwiML Application. Message status callback requests 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. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| Attempt | integer | Total number of attempts made (including this request) to send the message regardless of the provider used |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

BodystringThe 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 characters (or 70 UCS-2 characters), the message is segmented and charged accordingly. For long body text, consider using the send_as_mms parameter.
ContentRetentionstringValues: retain, discard

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| ContentSid | string | For Content Editor/API 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 or by fetching your Templates. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

ContentVariablesstringFor Content Editor/API only: Key-value pairs of Template variables 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 are used.
ForceDeliverybooleanReserved

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

Fromstring (phone-number)The sender's Twilio phone number (in E.164 format), alphanumeric sender ID, Wireless SIM, short code, or channel address (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.
MaxPricenumber[OBSOLETE] This parameter will no longer have any effect as of 2024-06-03.

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| MediaUrl | array | 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 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 and carrier limits apply. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| MessagingServiceSid | string | The SID of the Messaging Service 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. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| PersistentAction | array | Rich actions for non-SMS/MMS channels. Used for sending location in WhatsApp messages. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

ProvideFeedbackbooleanBoolean indicating whether or not you intend to provide delivery confirmation feedback to Twilio (used in conjunction with the Message Feedback subresource). Default value is false.
RiskCheckstringValues: enable, disable
ScheduleTypestringValues: fixed

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

SendAsMmsbooleanIf set to true, Twilio delivers the message as a single MMS message, regardless of the presence of media.
SendAtstring (date-time)The time that Twilio will send the message. Must be in ISO 8601 format.

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| ShortenUrls | boolean | For Messaging Services with Link Shortening configured 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. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| SmartEncoded | boolean | Whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be: true or false. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

StatusCallbackstring (uri)The URL of the endpoint to which Twilio sends Message status callback requests. 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.
TrafficTypestringValues: free

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| ValidityPeriod | integer | 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 36000. Default value is 36000. A validity_period greater than 5 is recommended. Learn more about the validity period |

delete(client, sid, opts \\ [])

@spec delete(Twilio.Client.t(), String.t(), keyword()) ::
  {:ok, map()} | {:ok, map(), map()} | :ok | {:error, Twilio.Error.t()}

Deletes a Message resource from your account

Operation: DeleteMessage | Tags: Api20100401Message

fetch(client, sid, opts \\ [])

@spec fetch(Twilio.Client.t(), String.t(), keyword()) ::
  {:ok, Twilio.Resources.Api.V2010.Message.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}

Fetch a specific Message

Operation: FetchMessage | Tags: Api20100401Message

list(client, params \\ %{}, opts \\ [])

@spec list(Twilio.Client.t(), map(), keyword()) ::
  {:ok, Twilio.Page.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}

Retrieve a list of Message resources associated with a Twilio Account

Operation: ListMessage | Tags: Api20100401Message

Query Parameters

ParameterTypeDescription

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| To | string (phone-number) | Filter by recipient. For example: Set this parameter to +15558881111 to retrieve a list of Message resources sent to +15558881111. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| From | string (phone-number) | Filter by sender. For example: Set this parameter to +15552229999 to retrieve a list of Message resources sent by +15552229999. |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| DateSent | string (date-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_dates on and before a specific date), and >=YYYY-MM-DD (to find Messages with sent_dates on and after a specific date). |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| DateSent< | string (date-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_dates on and before a specific date), and >=YYYY-MM-DD (to find Messages with sent_dates on and after a specific date). |

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

| DateSent> | string (date-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_dates on and before a specific date), and >=YYYY-MM-DD (to find Messages with sent_dates on and after a specific date). |

stream(client, params \\ %{}, opts \\ [])

@spec stream(Twilio.Client.t(), map(), keyword()) :: Enumerable.t()

Stream: Retrieve a list of Message resources associated with a Twilio Account (lazy auto-pagination).

update(client, sid, params \\ %{}, opts \\ [])

@spec update(Twilio.Client.t(), String.t(), map(), keyword()) ::
  {:ok, Twilio.Resources.Api.V2010.Message.t()}
  | {:ok, map(), map()}
  | :ok
  | {:error, Twilio.Error.t()}

Update a Message resource (used to redact Message body text and to cancel not-yet-sent messages)

Operation: UpdateMessage | Tags: Api20100401Message

Optional Parameters

ParameterTypeDescription

credo:disable-for-next-line Credo.Check.Readability.MaxLineLength

BodystringThe new body of the Message resource. To redact the text content of a Message, this parameter's value must be an empty string
StatusstringValues: canceled