Sms not sending when using automate actions to add a record to entity

Any critical bugs will be fixed within 24-48 hours.
Post Reply
s980845
Sponsor
Sponsor
Posts: 215
Joined: 03 Jun 2021, 22:06
Name: Bradley Hayes
Location: USA Palmdale
Company Name: Two-Lifestyles, Inc.
Contact:

Sms not sending when using automate actions to add a record to entity

Post by s980845 »

We setup a sub entity called Marketing SMS with an automated action that will add a record to it with the phone number being Value From Parent Entity, and the message content being manually added. The Parent entity is using the phone fieldtype. We did this to be able to send SMS announcements and info to multiple clients at once, since the default ClickSend module doesn't support this. We used the SMS sending rules to detect when a record is added to the Marketing SMS subentity.

If using the phone fieldtype, ClickSend returns with an error and wont send the messages. It looks like the format of the phone number is being altered by the phone fieldtype.

If i set the fieldtype to Input, and do the same actions, all the messages will send fine.

We would prefer to keep the phone fieldtype if possible, as we also use the telephony module to click/tap phone numbers to make calls, and this wont work from the Input fieldtype.
s980845
Sponsor
Sponsor
Posts: 215
Joined: 03 Jun 2021, 22:06
Name: Bradley Hayes
Location: USA Palmdale
Company Name: Two-Lifestyles, Inc.
Contact:

Re: Sms not sending when using automate actions to add a record to entity

Post by s980845 »

Nevermind. I was able to fix the code. It turns out, when running automated actions, it was putting the phone number twice. At least for our usecase, I was able to fix it by adding a check for string length since we are only texting local numbers.
I added this to the clicksend.php file.

foreach($destination as $phone)
{
$phone = preg_replace('/\D/', '', $phone);
$alerts->add($this->'DEBUG PRINT (Before): ' . $phone);

if(strlen($phone)>=13)
{
$phone = substr($phone, 0, 10);
$alerts->add($this->'DEBUG PRINT (After): ' . $phone);
}

Ignore the debug print. Was using this to figure out the issue.
Post Reply