2

We are trying to create a new extension for an SMS provider and after days of struggling, we're still not successful, even if a great part of the job is probably done.

We followed the documentation and got a lot of information out of the existing extensions (twilio, clickatel, ring central) and this was already really helpful.

The thing is that we are stuck and we would need logs or error message to better understand what's going on with the code.

How do developers usually work on a (new) extension? Should we use cv to try out the functions?

5
  • 1
    Did you see civicrm.org/extensions/dummy-sms-provider - it's a simple SMS extension that may give you some ideas? Dec 23, 2020 at 20:38
  • I made the ringcentral one so if there's something specific you're stuck on I might be able to remember. But in terms of how to develop I'm not sure what you mean. Do you mean how to test SMS without getting billed for every test? Ringcentral is free during development, not sure about others. Or are you looking for generic development tips on how to understand what core civi is doing?
    – Demerit
    Dec 24, 2020 at 0:25
  • @MatthewWire I didn't know about dummy SMS. Thanks a lot. we'll for sure give a try. Dec 24, 2020 at 8:54
  • @Demerit We saw your extension and the very detailed code and it also helps a lot. We have a test account at our SMS provider (French company named Alinto) with a high quota of SMS. My question was more about how to get error messages and if using 'cv' would help us to debug our code. Dec 24, 2020 at 9:01
  • 1
    You can do the usual things like add code to log to ConfigAndLog, e.g. \Civi::log()->debug('here is some debugging'); or if you really want to understand in detail what is happening use xdebug and an IDE to run through the code stepping through it line by line. I'm not sure cv would add much here but you might be able to use it to automate a script that sends an SMS for testing.
    – Demerit
    Dec 24, 2020 at 14:10

2 Answers 2

2

You might want to start with https://docs.civicrm.org/dev/en/latest/ if you haven't seen that before. To try out API functions, I would encourage you to login to a civi instance and go to the menu beside Administer, ie Support > Developer > APIv3 (or preferrably APIv4 if it has what you want), then test things there. The same functionality is available on your iwn instance. Note especially the callback methods available under https://docs.civicrm.org/dev/en/latest/hooks/

There are CiviCRM logs available at sites/default/files/civicrm/ConfigAndLog/ but you may also need to look at your Apache and occasionally MySQL logs too. Welcome, and good luck.

1
  • thanks Joe. The API v3 (for SMS) was of great help to succeed. Dec 29, 2020 at 17:45
1

Thanks to all of you who helped us creating our first extension. We've just published it on our Git account. Users in France can now send through a local and professional company.

6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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