FireDAC Components for Twilio

Build 21.0.7930

Messages

Create, update, delete, and query SMS and MMS Messages in Twilio.

Select

Twilio allows only a small subset of columns to be used in the WHERE clause of a SELECT query. These columns can typically be used with only the equals or = comparison. The available columns for Messages are Sender, To, DateSent, and Sid. DateSent may be used with the >, >=, <, <=, or = conditions.

SELECT * FROM Messages WHERE Sid = 'MS123456789' AND DateSent > '2015-10-10' 

Insert

To add a Message, specify Body, MediaUrl, or both, and To. At least one of the following conditional parameters must also be included: MessagingServiceSid or Sender.

INSERT INTO Messages(To,Sender,Body) VALUES ('+12345678965','+12019493653','Hi!') 

INSERT INTO Messages(To,Sender,MediaUrl) VALUES ('+12345678965','+12019493653','http://www.mycompany.com/ui/img/logo.png') 
Note: Up to 10 MediaUrl can be added per message as comma-separated-values.
INSERT INTO Messages(To, Sender, Body, MediaUrl) VALUES ('+12345678965', '+12019493653', 'Hi again!', 'http://www.mycompany.com/ui/img/logo.png,http://www.mycompany.com/ui/img/logo2.png')

Update

To update a Message record, the Body column must be empty.

UPDATE Messages SET Body = "" WHERE Sid='M1233455'

Delete

Messages cannot be deleted if the status is sending.
DELETE FROM Messages WHERE Sid = 'M123456789' 

Columns

Name Type ReadOnly References Description
Sid [KEY] String True

The Id of the messages.

DateCreated Datetime True

The creation date of the message.

DateUpdated Datetime True

The modification date of the message.

DateSent Date True

The sent date of the message.

AccountSid String True

The account Id of the message.

To String False

The phone number the message was sent to.

Sender String False

The phone number or sender Id that sent the message.

MessagingServiceSid String True

The messaging service Id of the message.

Body String False

The body of the message.

MediaUrl String False

The URL of the media you wish to send out with the message.

Status String True

The status of the message. One of the following values: accepted, queued, sending, sent, failed, delivered, undelivered, receiving, or received.

NumSegments Integer True

The number of segments that make up the message.

NumMedia Integer True

The number of media files associated with the message. The maximum is 10.

Direction String True

The direction of the message. One of the following values: inbound, outbound-api, outbound-call, or outbound-reply.

ApiVersion String True

The API version of the message.

Price Decimal True

The price of the message.

PriceUnit String True

The currency of the message.

ErrorCode String True

The error code of the message.

ErrorMessage String True

The error message.

Uri String True

The URI of the message.

Copyright (c) 2021 CData Software, Inc. - All rights reserved.
Build 21.0.7930