Send SMS txt to phones?

Topics related to AppGini plugins/add-ons go here.
Post Reply
mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Send SMS txt to phones?

Post by mqley » 2022-04-16 10:41

Hi, say I want to txt message all people signed up. Would that be possible?
Best Wishes,

Mark

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Send SMS txt to phones?

Post by pbottcher » 2022-04-16 16:59

Hi,

there is no such function build-in AppGini. You may connect to an external service to acheive this, but need to code it.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Re: Send SMS txt to phones?

Post by mqley » 2022-04-17 09:06

Ok thanks, I thought as much. It would be too much of a project for me to code it. Let me know if you ever decide to code such a plugin though as I would be interested.
Best Wishes,

Mark

mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Re: Send SMS txt to phones?

Post by mqley » 2022-04-18 07:11

Hi again, just out of interest. Would you know of any 3rd party companies that AppGini could connect to? I appreciate there would be coding via the Appgini end, but would be interesting to make some progress toward the goal.
Best Wishes,

Mark

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Send SMS txt to phones?

Post by jsetzer » 2022-04-18 07:24

twilio.com is a well known company offering paid SMS gateway services (and other gateway services). There are many others on the market.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Re: Send SMS txt to phones?

Post by mqley » 2022-04-18 10:57

Great thanks. Actually thinking about it. Is it possible to send phone Notifications to Android/Apple. Presume that's an whole new debate/level?
Best Wishes,

Mark

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Send SMS txt to phones?

Post by pbottcher » 2022-04-18 17:44

Hi,

actually your need is not very clear, so it is not easy to help. Why cant you just use the mail function?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Re: Send SMS txt to phones?

Post by mqley » 2022-04-18 19:51

Hi, that's a good question - well I wanted something more instant, whereas email doesn't always get noticed.
Best Wishes,

Mark

mqley
Veteran Member
Posts: 70
Joined: 2020-07-19 13:25
Contact:

Re: Send SMS txt to phones?

Post by mqley » 2022-04-18 20:52

That said, as it's in place already - it may well be ok. Was just interested in what was possible
Best Wishes,

Mark

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Send SMS txt to phones?

Post by jsetzer » 2022-04-18 21:01

Much is possible: immediate in-browser notification of logged in users, WhatsApp notification, Email or SMS. It depends on your requirements and budget.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

Alisson
Veteran Member
Posts: 81
Joined: 2017-02-25 20:32

Re: Send SMS txt to phones?

Post by Alisson » 2022-04-20 16:45

I've been using Twilio for a long time without any problems.
After creating an account with twilio and downloading their files.
Just add this to /hooks/tablename.php at the beginning of the file:

Code: Select all

 require_once $_SERVER["DOCUMENT_ROOT"]."/vendor/twilio-php-master/Twilio/autoload.php";
 use Twilio\Rest\Client;
and add this to the end:

Code: Select all

function sendSMS($data, $memberInfo){
  $staffPhone	= sqlValue("select custom2 from membership_users where memberID='{$data['username']}'");
  $sid = 'YOUR SID';
  $token = 'YOUR TOKEN';
  $client = new Client($sid, $token);
  $client->messages->create("$staffPhone",
  array('from' => 'YOUR TWILIO NUMBER HERE',
      'body' => "Body message here".
      "\n\n".
      "Field: {$data['field']}".
      "\n\n".
      "Thank you!!!")
   );
  break;
}
Then you can call sendSMS inside after_update, or after_insert:

Code: Select all

function yourTableName_after_update($data, $memberInfo, &$args){
  sendSMS($data, $memberInfo);
  return TRUE;
 }

hinoue
Posts: 5
Joined: 2022-05-12 07:14

Re: Send SMS txt to phones?

Post by hinoue » 2023-05-18 22:07

How do you loop through the list of phone numbers obtained from SQL with this function to send SMS to multiple recipients?

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: Send SMS txt to phones?

Post by onoehring » 2023-05-19 07:14

Hi,

even as this should be easy to find online (google) ... try something like this

Code: Select all

$sqlString = "SELECT field1, field2 FROM yourtable;";
$sql_Result = sql($sqlString, $eo);
while ($row_Fields = db_fetch_assoc($sql_Result)) {
    DO SOMETHING HERE WITH $row_Fields['field1'] AND $row_Fields['field2']
}
Olaf

hinoue
Posts: 5
Joined: 2022-05-12 07:14

Re: Send SMS txt to phones?

Post by hinoue » 2023-05-19 23:53

Thank you-- ended up using foreach (explode(",", $toNumbers) as $toNumber) in order to pass each phone number from a table.

Post Reply