CreateOptInMessage
Creates a Short Message Service (SMS opt-in message in Salesforce Marketing Cloud. This message confirms a recipient's consent to receive future SMS communications and records subscription details for compliance tracking.
Input
| Name | Type | Required | Description |
| LongCode | String | False | Specifies the long code on which the opt-in message is created. A long code is a standard ten-digit number used for two-way Short Message Service (SMS) communication. Either a long code or short code is required for message setup. |
| ShortCode | String | False | Specifies the short code on which the opt-in message is created. A short code is a five- or six-digit number that supports high-volume SMS programs. Either a long code or short code must be provided when configuring the opt-in message. |
| MessageName | String | True | Specifies the display name that identifies the opt-in message within Salesforce Marketing Cloud. This name is used for management, reporting, and API reference. |
| MessageText | String | False | Specifies the text content of the opt-in message that users receive during the subscription process. The message typically includes welcome or instructional text that introduces the subscription program. |
| CountryCode | String | False | Specifies the two-letter country code that identifies the country to which the short code belongs. This value is required for short-code messages and ensures that message routing and compliance follow country-specific carrier regulations. |
| Keyword | String | True | Specifies the keyword that users text to subscribe to the message program. The keyword triggers the opt-in workflow and must be unique within its long code, short code, and country combination. |
| MessageOptInType | String | True | Defines the opt-in workflow template that determines how user confirmation is handled. Acceptable types include 'Single', 'Double', and 'Age'. 'Single' opt-in requires users to send one keyword (for example, 'JOIN') to subscribe. 'Double' opt-in requires an additional confirmation message (for example, 'Y' or 'YES'). 'Age' opt-in uses the double opt-in process with an added age confirmation step that verifies the user's eligibility before finalizing the subscription. |
| ResponseMessage | String | False | Specifies the message that is sent to users after they text the keyword in a 'Single' opt-in workflow. This parameter is required for 'Single' and is ignored for 'Double' or 'Age'. The message confirms successful enrollment and can include program details or help instructions. |
| DoubleOptInInitialMessage | String | False | Specifies the message that is sent to users to request confirmation of their opt-in in a 'Double' or 'Age' workflow. This message is required for both 'Double' and 'Age' types and prompts users to reply with a valid confirmation response or their age, as appropriate. |
| DoubleOptInConfirmationMessage | String | False | Specifies the confirmation message that is sent to users after they reply with 'Y' or 'YES' in a 'Double' workflow or after they complete the age confirmation step in an 'Age' workflow. This message confirms successful opt-in and is required for 'Double' and 'Age' templates. |
| DoubleOptInValidResponses | String | False | Lists the valid confirmation responses that users can send in a 'Double' workflow (for example, 'Y' or 'YES'). This parameter is required for 'Double' and ignored for 'Single' and 'Age' workflows. Validation ensures that only predefined confirmation responses trigger successful subscription. |
| OptInInvalidAgeMessage | String | False | Specifies the message that is sent to users whose provided age does not meet the minimum requirement in an 'Age' opt-in workflow. This message is required for 'Age' and is ignored for 'Single' and 'Double'. It helps maintain compliance with age-based subscription policies. |
| MinimumAge | Integer | False | Defines the minimum age that users must meet to be subscribed through an 'Age' workflow. This parameter is required for 'Age' and ignored for 'Single' and 'Double'. Users who provide a lower age recieve the message that is defined in the OptInInvalidAgeMessage field instead of being subscribed. |
| AllowSingleOptIn | Boolean | False | A Boolean field that returns a value of 'true' when users are allowed to receive a different response if they are already opted in to the same program. It returns a value of 'false' when duplicate opt-ins are not differentiated. |
| DuplicateOptInMessage | String | False | Specifies the message that is sent to users who attempt to opt in when they are already subscribed. This message acknowledges the duplicate opt-in attempt and can include program reminders or additional call-to-action text. |
| OptinErrorMessage | String | True | Specifies the message that is sent to users when an error occurs during the opt-in process. This message ensures that the user receives a meaningful response even when system or configuration issues prevent successful enrollment. |
| StartDate | Date | True | Defines the date and time when the opt-in message becomes active and available for user interaction. Messages sent before this date are not processed by the opt-in workflow. |
| EndDate | Date | True | Defines the date and time when the opt-in message becomes inactive. If users attempt to opt in after this date, they receive the default keyword response for the associated code or the response message of the replacement keyword. This behavior ensures continuity for users and prevents expired campaigns from receiving new opt-ins. |
| NextKeyword | String | False | Specifies the keyword that is automatically appended to the next inbound message that users send after the initial opt-in message. For example, if the NextKeyword value is 'ZIP', the system prompts users to reply with their postal code after subscribing. This parameter enables sequential data collection for progressive profiling. |
Result Set Columns
| Name | Type | Description |
| MessageID | String | Returns the unique identifier (Id) of the opt-in message that is created. This system-generated value can be used in subsequent API operations to retrieve, modify, or delete the opt-in configuration. |