2

I set up a clickatell account and configured it in Civi. It only works if the phone number has a 1 in front for the country code. None of our numbers have the country code, is there a way around this?

  • 1
    That is the reason we decided to go with Twilio. It was either reformat all of our phone numbers into a format which would be strange for normal usage or go with a different SMS provider. – Allen Hutchison Feb 22 '16 at 19:05
  • It's also possible to do some customization to prepend the country code before sending so you don't have to add it in the UI. You might need a developer/consultant's help with this but it's certainly been done, and AFAIK works well. – Lesley Carter - BackOffice Feb 22 '16 at 19:16
2

I just faced (and fixed) this problem three days ago for a client by patching the Clickatell extension to prepend the "1" where it doesn't already exist.

In short - someone already wrote this patch, but it only works if you don't have contacts you want to text outside the US and UK. The patch is referenced on CRM-14160 - or just find it here.

If you're not a developer, but you feel comfortable installing an extension from a zip file, I just made a Github repo here with the patched extension. That said - I don't want to post it as the "new" Clickatell extension, because it makes some country-specific assumptions.

You can see that I updated the CRM-14160 ticket with what I think is the ultimate solution - which is for CiviCRM to know the country code associated with each country. Then the Clickatell extension could check for whether it's present or not - and if not, then prepend it.

|improve this answer|||||
1

Update your numbers to include a country code.

This will vary based on the format you've input data, but the below works for the sample dataset used on the demo sites.

-- a couple of formats including area code and local number
UPDATE civicrm_phone SET phone = CONCAT('+1 ', phone) 
 WHERE phone LIKE '(___) ___-____';
UPDATE civicrm_phone SET phone = CONCAT('+1 ', phone) 
 WHERE phone LIKE '___ ___-____';

-- local numbers get your assumed area code prepended also
UPDATE civicrm_phone SET phone = CONCAT('+1 555 ', phone) 
 WHERE phone LIKE '___-____';

When doing this, make sure to make backups and work on test data so you avoid loss.

There is a trigger civicrm_phone_before_update which will handle updating the civicrm_phone_numeric column.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.