Corbit SMS Form Notifications

By corbitsms

0+ active installationsVersion 1.0.1

SMS for WPForms through Corbit: a reply to the number typed in the form and an alert to the site owner, with per-form texts and sending limits.

Description

Corbit SMS Form Notifications sends text messages through your Corbit account when someone submits one of your WPForms forms. It works with WPForms Lite (free) and WPForms Pro, version 1.8.0 or newer.

For each form you choose:

  • Reply SMS to the mobile number the visitor typed in the form, for example “Thank you {name}, we received your request.”
  • Site owner alert to up to five of your own mobile numbers for every entry.
  • The text of each message, with WPForms Smart Tags for any form value (name, service, date and so on), the form name and the site name.
  • The sender name, or the default one.

Features

  • Per-form settings in the form builder: Settings > Corbit SMS.
  • Approved sender names are read from your Corbit account and offered in a list. Your SMS balance is shown on the settings page.
  • The Corbit API token is stored encrypted with your site security keys (libsodium) and is never shown again after saving.
  • Allowed countries: only numbers in the countries you allow receive SMS (by default the default country, Saudi Arabia), so nobody can make your form send costly international messages.
  • Sending limits against abuse, because anyone can submit a public form and every SMS uses your balance: entries per visitor IP address per hour, messages per mobile number per day, messages per form per day, and messages per day for the whole site. They are checked and counted under a database lock, so many entries sent at the same moment cannot slip through.
  • In the reply SMS, each value typed by the visitor is cut to 100 characters and web addresses are removed from it, and only the form’s own values, the form name, the form ID, the site name and the date are filled in; any other Smart Tag is removed. Messages are cut to 469 characters (seven Arabic SMS parts). For a reply SMS, also turn on a CAPTCHA in the form’s Spam Protection and Security settings, and keep the reply short: the visitor chooses the number it goes to.
  • Only administrators can change the SMS settings of a form or of a saved form template.
  • Saudi mobile numbers are checked before sending (05XXXXXXXX, 5XXXXXXXX, +9665XXXXXXXX, 009665XXXXXXXX and Arabic digits). Landlines and invalid numbers are skipped instead of wasting a request.
  • Messages are only sent for entries that pass WPForms validation and spam protection. A sending problem never stops the form from being submitted: the messages of one entry wait for Corbit for about 12 seconds in all, and any message still waiting after that is listed as not sent.
  • Test SMS from the settings page, and a list of the last 100 sends with masked numbers.
  • Translation ready.

External services

This plugin connects to the Corbit SMS API (https://api.corbit.sa) to send SMS messages. The service is required for all SMS features.

The plugin sends data to the service in these cases only:

  • When a form with SMS switched on is submitted, and when an administrator sends a test SMS: the recipient’s mobile number, the sender name, and the message text. The message text contains the values the administrator placed in it with Smart Tags, such as what the visitor typed in the form.
  • When an administrator opens WPForms > Corbit SMS: requests for the account’s sender names and SMS balance. They are kept for 10 and 5 minutes, and the Refresh button reads them again.
  • When a user who can edit forms opens a form in the form builder: a request for the account’s sender names (kept for 10 minutes).

Nothing is sent before an API token is saved. Every request carries the site’s Corbit API token, and goes through the WordPress HTTP API, which also sends your site’s address in its User-Agent header.

The service is operated by Corbit Company (https://corbit.sa). A Corbit SMS account, an approved sender name and SMS balance are required. Corbit’s terms of use and privacy policy are published on its SMS portal, app.mobile.net.sa:

Terms of use: https://app.mobile.net.sa/terms-of-use
Privacy policy: https://app.mobile.net.sa/privacy-policy.pdf

Privacy

The plugin stores no form entries. The list of recent sends keeps the date, the form, the masked number (last four digits) and the result; message texts are not kept. Sending-limit counters are stored under keyed hashes, never as IP addresses or numbers, and expire within a day. Deleting the plugin removes its settings, the encrypted token, the recent sends and the counters. The SMS settings of each form (texts and site owner numbers) are saved inside the form and stay with it. The plugin adds a suggested paragraph to Settings > Privacy for your privacy policy.

Installation

  1. Install and activate WPForms (Lite or Pro) 1.8.0 or newer.
  2. Install this plugin from Plugins > Add New, or upload the ZIP file, and activate it.
  3. Open WPForms > Corbit SMS, paste your Corbit API token and save. Your approved sender names and your balance appear.
  4. Choose the default sender name and save. Send a test SMS to your own number.
  5. Edit a form, open Settings > Corbit SMS, switch on the reply SMS and/or the site owner alert, choose the mobile number field, write the texts, and save the form.

FAQ

Where do I get an API token?

From your Corbit SMS account: sign in at https://sms.corbit.sa and copy your API token. You also need at least one approved sender name.

Which field can hold the mobile number?

A Phone field (WPForms Pro), or a Single Line Text, Numbers or Hidden field (WPForms Lite and Pro).

How do I put form values in a message?

Click “Show Smart Tags” under the message box and choose a field. It adds a tag like {field_id=”1″}, which is replaced by what the visitor typed. {form_name} and {site_name} also work. In the reply SMS only form values, {form_name}, {form_id}, {site_name}, {date} and {unique_value} are filled in, and a space should separate two tags; the site owner alert accepts every Smart Tag.

Why was a message not sent?

WPForms > Corbit SMS lists the last 100 sends with the reason for each one that was skipped or failed: a missing or invalid mobile number, a sending limit, no sender name, or an error from Corbit such as no balance.

What do the sending limits do?

They stop one visitor or a bot from using your balance. By default: 5 entries per visitor per hour, 3 messages per mobile number per day, 200 messages per form per day, and 300 messages per day for the whole site. Set any of them to 0 for no limit.

Can I send SMS to numbers outside Saudi Arabia?

Yes. Add their country calling codes in WPForms > Corbit SMS > Allowed countries, for example 966, 971. Numbers in other countries are refused. Add only the countries you need: code 1, for example, also covers Caribbean numbers that are often used for SMS fraud.

Does it work with any database?

It needs MySQL or MariaDB, which nearly every WordPress host uses: the sending limits are checked under a MySQL lock (GET_LOCK). On a site without it, messages are not sent and the recent-sends list says why.

My site is behind Cloudflare or a proxy.

Choose the matching “Visitor IP address” option in the settings, so the per-visitor limit counts real visitors and not your proxy. The header is only trusted when the connection comes from Cloudflare’s addresses or from a proxy in your private network. If Cloudflare reaches your site through another proxy on the same server, choose X-Forwarded-For or X-Real-IP and make that proxy pass the visitor’s address. Sites that send database reads to read-only copies (HyperDB, LudicrousDB) must send the plugin’s GET_LOCK query to the main database.

What happens to the token if I change the site security keys?

The token is encrypted with them, so it can no longer be read. The settings page says so; paste the token again. You can also define your own key in wp-config.php: define( 'CORBIT_SMS_WPFORMS_KEY', 'a long random text of at least 32 characters' );

If your wp-config.php has no SECURE_AUTH_KEY and SECURE_AUTH_SALT, WordPress keeps its keys in the database; the settings page then asks you to add them, so that a copy of the database alone does not reveal the token.

Screenshots

Changelog

1.0.1

  • Mobile numbers: a bracket at the start may only hold a country code, so “(+971501234567) 1” is refused instead of becoming another number; a number with the right-to-left override mark is refused, also in the site owner’s alert numbers, because the screen would show the digits in a different order.
  • Mobile numbers: length limits are checked first and every check runs in linear time, so very long input is refused quickly.
  • The mobile number field is no longer shortened before it is read: a value longer than 200 characters is refused instead of being cut.
  • A very long value typed in a form field is cut before the reply SMS removes links from it, so it cannot slow the site down.

1.0.0

  • First release.
  • Reply SMS to the number in the form and site owner alert, per form, with Smart Tags.
  • Approved sender names and SMS balance from the Corbit account; a sender name per form.
  • Encrypted API token.
  • Allowed countries; sending limits per visitor, per mobile number, per form and per site, checked under a database lock.
  • Links removed from visitor values in the reply SMS; only administrators change a form’s SMS settings.
  • Test SMS and recent sends.