I use NowSMS for my SMS provider instead of Twilio and Clickatell. NowSMS goes through a cell phone, which is flat rate pricing instead of per text. I've found documentation for twilio or clickatell, but none about the api itself. Can someone point me toward documentation for the civicrm hooks or the "add new provider" screen? I assume civicrm does http/https in and out based on some triggers or web hooks, etc, soap, rest, xml, something? I'm self hosting civicrm on wordpress on my LAN, and NowSMS server is on the same lan, no authentication required, very very easy to program via simple http get commands with two phone numbers and some text. Anyway, yes, documentation please? We've already paid for NowSMS, and we currently use it quite successfully on other projects, so we are not willing to switch, thank you. Any help appreciated!
-
This is very cool - please update this when it's done with a link to the extension? Thanks!– Jon G - Megaphone TechNov 21, 2019 at 5:10
-
Honestly writing an extension is a bit over my head as I don't program in PHP. I was hoping I could do it with webhooks.– Jason MillerNov 22, 2019 at 15:18
-
So is that a negative on documentation on API Type, API URL, and API Parameters?– Jason MillerJan 10, 2020 at 17:07
2 Answers
You need to write an extension (https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-module), and you can use the existing provider extensions as a template and change what you need. You can also look at other third party extensions. I wrote one recently (https://lab.civicrm.org/extensions/ringcentral), which has some maybe nonstandard things, but mostly I copied and pasted the overall structure from twilio and clickatell, e.g. https://github.com/civicrm/org.civicrm.sms.twilio/blob/master/org_civicrm_sms_twilio.php
-
Thanks.. good answer, but writing an extension is over my head. I was hoping for a way to do with only webhooks. Nov 22, 2019 at 15:20
-
I took a stab at this, and I created the extension, and I can see how the basic idea is to extend the CRM_SMS_Provider object and provide functions for send() and inbound(), but there's a lot of voodoo in those php files I don't understand. Let me ask you, how much coding should be required to implement this specific api consider how very, very simple it is. NowSMS uses http get with 3 variables in and 3 variables out, no encryption or security of any kind. From looking at these other extensions it seems a good deal of code is devoted to things other than sending and receiving the payload. Feb 9, 2020 at 21:15
API documentation exists - https://docs.civicrm.org/dev/en/latest/api. You might even be able to get incoming SMS without coding an extension, using either the standard REST API or with the Form Processor extension. However, you're not going to get Civi to submit a request to an external URL without an extension.
That said - CiviRules handles a significant chunk of what you're trying to do. However, there's no "submit to an external URL" action. If you were to sponsor the authorship of such an action, you could probably get quite a lot of mileage out of it.