Problem statement

Tokenization is one of the key features in the previous versions of SMS Framework. The user could place tokens in the SMS message and it would be replaced with actual values prior to dispatching of the message.

Drupal 8 version of SMS Framework has not yet implemented tokenization.

Proposed Solution: Re-implement tokenization in SMS messages

This proposal will implement an EventSubscriber to the SmsEvents::MESSAGE_OUTGOING_PRE_PROCESS event that replaces the tokens. If the replacement of tokens results in differences between the messages, then the messages will be chunked into several with recipients that share common messages being bunched together.

Remaining Tasks

Discuss
Write patch
Review
Commit

API changes

None

Data model changes

None

User Interface changes

None

Comments

almaudoh created an issue. See original summary.

dpi’s picture

The user could place tokens in the SMS message and it would be replaced with actual values prior to dispatching of the message.

We have the message with tokens, and we have context values. Why not do the replacement immediately? How could the context values change between provider->send and a new PRE_PROCESS subscriber.

If the replacement of tokens results in differences between the messages

If the context values are the same for the message, why would there be differences?

---

Usually the context values are inserted by the executing code, lets say a form with a message field. Between form submission, and a theoretical PRE_PROCESS function, what can SMS Framework offer? As opposed to the form doing a simple token replace ($message = \Drupal::token()->replace($message, $tokens); ) itself?

Why should we have to do token search and replace on every message? Resulting in a performance hit.

I did this a while back for Courier so I can speak a little about tokens. Courier offers its own internal special tokens, which is why it gathers context and does search and replace itself.

almaudoh’s picture

Project: SMS Framework » SMS UI
Component: Core Framework » Code

Oops! This was meant for another issue queue. :)