latestSwagger 2.02026-08-101561322.2 MB

3e4029d19684

Outbound Messages

Preview message

<a class="try-sandbox-link" href="https://sandbox.textmagic.com/#/Messages%3A%20Send%0A/getMessagePreview" target="_blank">Try in sandbox</a><br>Get a messages preview (with dynamic fields merged) of up to 100 messages per session.

get/api/v2/messages/preview

Query parameters

textstring

Message text. Required if template_id is not set.

templateIdinteger

Template used instead of message text. Required if text is not set.

sendingTimeinteger

DEPRECATED, consider using sendingDateTime and sendingTimezone parameters instead: Optional (required with rrule set). Message sending time is in unix timestamp format. Default is now.

sendingDateTimestring

Sending time is in Y-m-d H:i:s format (e.g. 2016-05-27 13:02:33). This time is relative to the sendingTimezone.

sendingTimezonestring

The ID or ISO-name of the timezone used for sending when the sendingDateTime parameter is set, e.g. if you specify sendingDateTime = "2016-05-27 13:02:33" and sendingTimezone = "America/Buenos_Aires", your message will be sent on May 27, 2016 13:02:33 Buenos Aires time, or 16:02:33 UTC. Default is the account timezone.

contactsstring

Comma-separated array of contact resources id message will be sent to.

listsstring

Comma-separated array of list resources id message will be sent to.

phonesstring

Comma-separated array of E.164 phone numbers message will be sent to.

cutExtra0 | 1

Should sending method cut extra characters which not fit supplied partsCount or return 400 Bad request response instead.

partsCountinteger

Maximum message parts count (Textmagic allows sending of 1 to 6 message parts).

referenceIdinteger

Custom message reference id which can be used in your application infrastructure.

fromstring

One of the allowed Sender ID (phone number or alphanumeric sender ID). If the specified Sender ID is not allowed for some destinations, a fallback default Sender ID will be used to ensure delivery. See Get timezones.

rulestring

An iCal RRULE parameter to create recurrent scheduled messages. When used, sendingTime is mandatory as the start point of sending. See https://www.textmagic.com/free-tools/rrule-generator for format details.

createChat0 | 1

Should the sending method try to create new Chat(if not exist) with specified recipients?

tts0 | 1

Send Text-to-Speech message.

local0 | 1

Treat phone numbers passed in the 'phones' field as local.

localCountrystring

The 2-letter ISO country code for local phone numbers, used when 'local' is set to true. Default is the account country.

Response

Returned when successful.

Example response

{
  "messages": [
    {
      "id": 4991,
      "text": "I love Textmagic!",
      "status": "d",
      "rejectReason": "a",
      "contactId": 2764,
      "sessionId": 3122,
      "messageTime": "2019-08-12T11:43:37+0000",
      "avatar": "avatars/dummy_avatar.png",
      "deliveredAt": "2026-05-18T19:25:45+0000",
      "charset": "ISO-8859-1",
      "charsetLabel": "ISO-8859-1",
      "firstName": "John",
      "lastName": "Conway",
      "country": "US",
      "phone": "447624800500",
      "price": 0.025,
      "partsCount": 6,
      "fromEmail": "test@email.com",
      "fromNumber": "447624800500"
    }
  ]
}