Nexmo sms form from invoice view

  1. You will need a NEXMO Account to implement this function.
  2. OPEN FILE application > modules > invoices > view > views.php.
  3. About line 335 PASTE
 <div class="panel panel-default no-margin">
                        <div class="panel-heading">
                        <?php $mobile = $invoice->client_mobile; ?>
                            Send an SMS to <?php echo $mobile; ?>
                        </div>
                        <div class="panel-body">
                            <div id="delivery" style="display:none"></div>

                         <form id="sms-form" method="post" action="https://rest.nexmo.com/sms/json?api_key=YOUR_API_KEY&api_secret=YOUR_API_SECRET&to=<?php echo $mobile; ?>&from=YOUR_NUMBER&type=unicode" target="_blank">
                            <textarea class="form-control" size="50" id="text" name="text" required>Hi <?php _htmlsc(format_client($invoice)) ?>, the tracking number for your order <?php if ($invoice->invoice_number) : ?> <?php echo $invoice->invoice_number; ?> <?php else : ?> <?php echo date('Ymd').'-00'; ?> <?php endif; ?> is: XXXXXXXX. Regards, YOUR_COMPANY</textarea>
							<br/><input type="submit" class="btn btn-danger" value="Send SMS!">
                          </form>
					   
                            </div>
                        </div>
                    </div>
  1. Replace the UPPERCASE_TEXT_ABOVE to suit your needs.
  2. Save and upload.

1 Like

This way you are exposing your mobile number and your Nexmo api key in your Html source.

I like the idea, but just post to a Controller action and from there do your actions

1 Like