Skip to content

Document continueSending API field and FilterEvent removal reasons - #665

Open
promptless-for-oss wants to merge 1 commit into
mautic:7.3from
Promptless:promptless/pr-17310-segment-sms-schedule-send
Open

Document continueSending API field and FilterEvent removal reasons#665
promptless-for-oss wants to merge 1 commit into
mautic:7.3from
Promptless:promptless/pr-17310-segment-sms-schedule-send

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open in Promptless

Mautic 7.x adds a Schedule Send workflow for Segment Text Messages, which exposes a developer surface. This documents the new continueSending boolean on the Text Messages REST API (in the properties and PUT/PATCH parameter tables), with a note that writing any schedule field requires publish permission and that publishDown reads back as null for a one-time list SMS. It also documents the optional reason parameter added to FilterEvent's removeContact/removeContacts/getRemovedContacts and the FilterEvent::REMOVAL_REASON_MISSING_NUMBER constant in the SMS extension guide, scoping the reason API to FilterEvent (DncEvent and QueueEvent are unaffected).

Documents mautic/mautic#17310.

Trigger Events

Add the continueSending scheduling field to the Text Messages REST API
reference (properties and PUT/PATCH tables) with a note on the
publish-permission requirement and publishDown read-back. Document the
optional reason parameter and REMOVAL_REASON_MISSING_NUMBER constant on
FilterEvent in the SMS extension guide, scoping them to FilterEvent.

Documents mautic/mautic#17310.
@@ -69,6 +72,12 @@ Use these properties when creating a Text Message in a ``POST`` request. These p
- int
- How many times the SMS got sent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/rest_api/text_messages.rst:73-73 at b595045

continueSending is a non-nullable boolean column (continue_sending) defaulting to false; verified against Sms::loadMetadata field definition, matching the doc's "omit for default one-time send" and boolean type claims.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Entity/Sms.php#L197-L203

@@ -69,6 +72,12 @@ Use these properties when creating a Text Message in a ``POST`` request. These p
- int
- How many times the SMS got sent

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/rest_api/text_messages.rst:73-73 at b595045

Sms::setContinueSending(false) on a list-type SMS clears publishDown to null, matching the doc's "false sends once and ignores publishDown" claim.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Entity/Sms.php#L448-L458


.. note::

Writing or changing any schedule field - ``isPublished``, ``publishUp``, ``publishDown``, or ``continueSending`` - requires the ``sms:smses:publishown`` or ``sms:smses:publishother`` permission. Without it, Mautic ignores these fields on write.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/rest_api/text_messages.rst:77-77 at b595045

CommonApiController strips isPublished/publishUp/publishDown/continueSending from write parameters when the user lacks ':publishown' access and cannot access the entity for 'publish', matching "Mautic ignores these fields on write." SmsModel::getPermissionBase() returns 'sms:smses', and SmsProcessor.php hardcodes 'sms:smses:publishown'/'sms:smses:publishother' as the permission strings.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/ApiBundle/Controller/CommonApiController.php#L522-L541


Writing or changing any schedule field - ``isPublished``, ``publishUp``, ``publishDown``, or ``continueSending`` - requires the ``sms:smses:publishown`` or ``sms:smses:publishother`` permission. Without it, Mautic ignores these fields on write.

``publishDown`` reads back as ``null`` for a one-time ``list`` SMS - one sent with ``continueSending`` set to false.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/rest_api/text_messages.rst:79-79 at b595045

Sms::getPublishDown() returns null when smsType is 'list' and continueSending is false, confirming publishDown reads back as null for a one-time list SMS.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Entity/Sms.php#L405-L412

- Whether a scheduled Segment SMS - one with type ``list`` - keeps sending or sends once, defaulting to one-time when omitted. ``false`` sends once and ignores ``publishDown``, while ``true`` keeps sending with an optional later ``publishDown`` stop time.
* - ``language``
- string
- Language locale of the SMS

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/rest_api/text_messages.rst:322-322 at b595045

Same continueSending property row repeated in the PUT/PATCH parameters table; verified against the same Sms entity field definition as the POST properties table.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Entity/Sms.php#L197-L203

* ``removeContacts(array $contacts)`` - Remove multiple Contacts
* ``getRemovedContacts()`` - Get the list of removed Contacts
* ``getContacts()`` - Returns the array of Contacts.
* ``removeContact(int $id, ?string $reason = null)`` - Remove a single Contact by ID. The ``reason`` is optional.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/plugin_extensions/sms.rst:204-204 at b595045

FilterEvent::removeContact(int $id, ?string $reason = null) signature matches the documented bullet exactly.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Event/FilterEvent.php#L55-L62

* ``getRemovedContacts()`` - Get the list of removed Contacts
* ``getContacts()`` - Returns the array of Contacts.
* ``removeContact(int $id, ?string $reason = null)`` - Remove a single Contact by ID. The ``reason`` is optional.
* ``removeContacts(array $contacts, ?string $reason = null)`` - Remove multiple Contacts. The ``reason`` is optional.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/plugin_extensions/sms.rst:205-205 at b595045

FilterEvent::removeContacts(array $contacts, ?string $reason = null) signature matches the documented bullet exactly.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Event/FilterEvent.php#L64-L72

* ``getContacts()`` - Returns the array of Contacts.
* ``removeContact(int $id, ?string $reason = null)`` - Remove a single Contact by ID. The ``reason`` is optional.
* ``removeContacts(array $contacts, ?string $reason = null)`` - Remove multiple Contacts. The ``reason`` is optional.
* ``getRemovedContacts(?string $reason = null)`` - Get the list of removed Contacts. Optionally pass a reason to return only the Contacts removed for that reason.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/plugin_extensions/sms.rst:206-206 at b595045

FilterEvent::getRemovedContacts(?string $reason = null) filters the removed list by reason when supplied, matching the documented bullet exactly.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Event/FilterEvent.php#L40-L53

* ``removeContact(int $id, ?string $reason = null)`` - Remove a single Contact by ID. The ``reason`` is optional.
* ``removeContacts(array $contacts, ?string $reason = null)`` - Remove multiple Contacts. The ``reason`` is optional.
* ``getRemovedContacts(?string $reason = null)`` - Get the list of removed Contacts. Optionally pass a reason to return only the Contacts removed for that reason.
* ``FilterEvent::REMOVAL_REASON_MISSING_NUMBER`` - the reason value Mautic core records when it removes a Contact that has no phone number.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/plugin_extensions/sms.rst:207-207 at b595045

SendSmsSubscriber::genericFilter() calls $event->removeContacts(..., FilterEvent::REMOVAL_REASON_MISSING_NUMBER) for contacts with no phone number, confirming the constant is defined in FilterEvent (L12) and passed by SendSmsSubscriber during generic filtering.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/EventListener/SendSmsSubscriber.php#L70-L81

* ``getRemovedContacts(?string $reason = null)`` - Get the list of removed Contacts. Optionally pass a reason to return only the Contacts removed for that reason.
* ``FilterEvent::REMOVAL_REASON_MISSING_NUMBER`` - the reason value Mautic core records when it removes a Contact that has no phone number.

The ``reason`` parameters are optional, so existing subscribers stay backward compatible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/plugin_extensions/sms.rst:209-209 at b595045

reason parameters default to null on FilterEvent::removeContact()/removeContacts(), so existing subscribers that omit the argument remain backward compatible.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Event/FilterEvent.php#L55-L72

Use ``SmsEvents::FILTER_CONTACTS_ON_SEND`` for any remaining filtering logic, such as removing Contacts without phone numbers. Its listener receives a ``FilterEvent``.

All three event classes share a common API, shown here for :xref:`FilterEvent source`:
The methods below describe ``FilterEvent``, whose signatures come from :xref:`FilterEvent source`. The optional ``reason`` parameters and the ``REMOVAL_REASON_MISSING_NUMBER`` constant are specific to ``FilterEvent``.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/plugin_extensions/sms.rst:201-201 at b595045

FilterEvent alone defines optional ?string $reason params on removeContact/removeContacts/getRemovedContacts and the REMOVAL_REASON_MISSING_NUMBER constant; DncEvent.php and QueueEvent.php have no reason param or constant, confirming these are FilterEvent-specific as the framing sentence now states.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Event/FilterEvent.php#L12


The ``reason`` parameters are optional, so existing subscribers stay backward compatible.

``getContacts()`` is common to all three events. ``DncEvent`` also exposes ``removeContact()``, ``removeContacts()``, and ``getRemovedContacts()``, but its ``removeContact()`` and ``removeContacts()`` take no ``reason`` parameter. ``QueueEvent`` instead exposes ``queueContact(int $id)``, ``queueContacts(array $contacts)``, and ``getQueuedContacts()``.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/plugin_extensions/sms.rst:211-211 at b595045

getContacts() is defined on FilterEvent, DncEvent, and QueueEvent. DncEvent::removeContact(int $id)/removeContacts(array $contacts)/getRemovedContacts() take no reason parameter (contrast with FilterEvent). QueueEvent has no remove* methods; it instead exposes queueContact(int $id), queueContacts(array $contacts), and getQueuedContacts() (see QueueEvent.php L20-L47 at the same commit), matching the paragraph exactly.

Source: https://github.com/mautic/mautic/blob/aea9f82c7214216ed968d4ff119e3e87d531775a/app/bundles/SmsBundle/Event/DncEvent.php#L23-L47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant