Twilio Issues

Your software
My Mautic version is:4.1.1
My PHP version is:7.4.3
My Database type and version is:10.3.34-MariaDB-0ubuntu0.20.04.1

Your problem
My problem is: I can send sms sometimes with twilio and others times I have errors. The error is get is
“Last execution error: Scheduled”

Can an sms have a merge field - {contactfield=firstname} ?

The sms is a simple text message less that 160 characters. It contains a 1st name merge field and a web address. I have a paid Twilio account and I have been able to successfully send a sms to my own number using mautic and the trial twilio account. My next test is also via a campaign to a segment of 3 people. Their numbers are formatted correctly.

These errors are showing in the log: [2022-04-18 14:13:42] mautic.NOTICE: PHP Notice - Trying to access array offset on value of type null - in file /var/www/mautic/app/bundles/SmsBundle/Form/Type/SmsSendType.php - at line 84 {“builder”:"[object] (Symfony\Component\Form\FormBuilder: {})",“options”:{“block_name”:null,“disabled”:false,“label_format”:null,“label_translation_parameters”:,“attr_translation_parameters”:,“translation_domain”:null,“auto_initialize”:true,“trim”:true,“required”:true,“property_path”:null,“mapped”:true,“by_reference”:true,“inherit_data”:false,“compound”:true,“method”:“POST”,“action”:"",“post_max_size_message”:“The uploaded file was too large. Please try to upload a smaller file.”,“allow_file_upload”:false,“help_translation_parameters”:,“error_mapping”:,“invalid_message”:“This value is not valid.”,“invalid_message_parameters”:,“allow_extra_fields”:false,“extra_fields_message”:“This form should not contain extra fields.”,“csrf_protection”:true,“csrf_field_name”:"_token",“csrf_message”:“The CSRF token is invalid. Please try to resubmit the form.”,“csrf_token_manager”:"[object] (Symfony\Component\Security\Csrf\CsrfTokenManager: {})",“csrf_token_id”:null,“block_prefix”:null,“label”:false,“row_attr”:,“attr”:,“data”:null,“data_class”:null,“empty_data”:"[object] (Closure: {})",“error_bubbling”:true,“label_attr”:,“upload_max_size_message”:"[object] (Closure: {})",“help”:null,“help_attr”:,“help_html”:false,“validation_groups”:null,“constraints”:,“update_select”:“campaignevent_properties_sms”},“windowUrl”:"/s/sms/new?contentOnly=1&updateSelect=campaignevent_properties_sms"}

Steps I have tried to fix the problem: I have double checked all the twilio / mautic integration settings. The Twilio log is not picking up the sms’s so it appears as if they are not. being to sent Twilio by mautic, ie the issue lies with mautic.

I believe this has been fixed in 4.2

Issue was that the per contact frequency rule for text is defaulted to blank. Mautic reads that as only allowing 1 text per day and ignores the frequency settings in the twilio plugin. Upping the frequency allowed in the per contact preference centre fixed the issue. You can globally fix the frequency issue by either upgrading to 4.2 or applying the PR fix found here Mautic 4 - Twilio, can't send more than 1 text message, it breaks after the first sms · Issue #10637 · mautic/mautic · GitHub

Big thanks to @mikew and @joeyk for taking time out to help find the issue and the fix