Skip to content

Rule.io SDK


Rule.io SDK / rcml/src / smsToXml

Function: smsToXml()

smsToXml(doc, options?): string

Defined in: rcml/src/sms/sms-to-xml.ts:38

Serialize an SmsDocument to an XML string.

The output is a single <rc-sms> element whose text content is the SMS RFM representation of the document's content. Combine with xmlToSms for the reverse direction.

Parameters

doc

SmsDocument

The SMS document to serialize.

options?

SmsToXmlOptions = {}

Formatting options.

Returns

string

An XML string.

Example

ts
const xml = smsToXml(createSmsDocument({ content: 'Hello [Subscriber:FirstName]' }))
// '<rc-sms>Hello [Subscriber:FirstName]</rc-sms>'