Appearance
Rule.io SDK / rcml/src / createSmsDocument
Function: createSmsDocument()
createSmsDocument(
options):SmsDocument
Defined in: rcml/src/sms/create-sms-document.ts:63
Create an SMS RCML document.
Returns an SmsDocument that can be passed to client.templates.createSmsTemplate or client.templates.updateSmsTemplate.
Parameters
options
SMS document options.
Returns
A valid SmsDocument.
Throws
When a pre-built SmsContentJson is supplied and fails schema validation.
Example
typescript
import { createSmsDocument } from '@rule/rcml';
// From an SMS RFM string
const doc = createSmsDocument({
content: 'Hi [Subscriber:FirstName], your order has shipped!',
});
// From a pre-built content JSON document
const doc2 = createSmsDocument({
content: {
type: 'doc',
content: [{ type: 'paragraph', content: [{ type: 'text', text: 'Hello!' }] }],
},
});
const template = await client.templates.createSmsTemplate({
name: 'Order shipped SMS',
content: doc,
});