How to post mobile numbers to a group in your account using a web form
Update: There is an easier way to post numbers to a group using our Form2SMS product
Most businesses have enquiry or order forms on their web site. This is a great way of collecting mobile numbers for later text marketing. Another use for collecting mobile numbers from a web form is for competitions where for example there may be an on pack promotion which people can text to but also a web entry form.
We have built a simple way to ‘inject’ mobile numbers into a group (you need to have already set up a group in your Text Marketer account).
What you’ll need:
- A group name for a group that’s already been created in your account. To create a group, in your Text Marketer account, go to Groups and select Create a Group (note: if you want to add numbers to a group for a shortcode keyword, a group may already have been created for it. It would be named using the format Short_[keyword]). Or go to Groups and Upload Numbers to a Group to check what groups already exist in your account. Make a note of the group name for the group you want to be able to add numbers to using a web form.
- Your API username and password (which may be different from your login details). Go to Settings and API Settings to get these in your account.
- A web form to collect the mobile number from your customers.
For those using PHP, two solutions for integrating this into a web form are provided below. After this is done, the mobile number of everyone who completes your form will be added to the send group specified.
Case 1 : Using a form we provide
You can download our PHP mobile number submission form. Copy the contents to a new PHP file (the name you give it is irrelevant) and put it on your server. You need to edit a few lines at the top of the file with the group name, API username and API password you collected earlier. If you now enter the corresponding web address that points to your new file, in your web browser you’ll see a simple web form asking you for a mobile number. If you enter a mobile number and click the submit button, it will add the number to the group you specified in the file, in your Text Marketer account.
The PHP script provided above contains a very simple form. The HTML for the form can be found at the bottom of the file. You may wish to pass this script and the details above to your web designer and they will be able to customise it to your own style.
Case 2: Integrating into your existing website form
If you already have a form on your website and you’d like to add the functionality to it so that the mobile numbers collected on your form are added to the group in your Text Marketer account, you can use this PHP include file. Change the .txt extension to .php and put the file in your includes folder.
To use the file, let’s say your web form contains an input text box named ‘mobile’ and the form action points to a file called submit.php. In your file submit.php you will simply add these lines of code:
include_once ('TMGroupAdd.inc.php'); // TODO change these! $username = 'myAPIusername'; $password = 'myAPIpassword'; $groupName = 'myGroupName'; $groupAdder = new TMGroupAdd($groupName, $username, $password); $success = $groupAdder->add($_REQUEST['mobile']);
Change the username, password and group name values with the details you gathered earlier. You can use the boolean variable $success to determine whether the add was successful or not.
For more advanced details about the data that is returned when you add a number to a group, see the REST API documentation.
- Upload a list of mobile numbers to a group
This article shows you how to upload a simple mobile number list with no other data fields. For help on...
- Deleting a number or numbers from a group
Deleting one or many mobile numbers from groups in your Text Marketer system is very straightforward. Download the PDF instruction...
- How many mobile numbers can I upload into a group?
Is their a maximum capacity for uploading numbers? No. There is no upper limit to the number of mobile numbers...
- REST SMS Gateway API – group resource
group This resource allows you to view and modify a send group. This blog post has been superseded with our website documentation This...
- How to Send an SMS Campaign to a Group
Send to Group Send to Group allows you to send an SMS Campaign to a single group or multiple groups...
- System Update – Upload your mobile numbers straight from Microsoft Excel
The development team at Text Marketer have had a busy few months and the latest system improvement has now been...
- Text Marketer Bulk SMS Account – System Instructions
Quick Start! I’ve set up my Text Marketer account, how do I get going quickly? Download the PDF instruction manual...
- How to send a Personalised / Merge Text Message
This article shows you how to use the merge function in our text messaging application. This is useful when you want...
- How to transfer text credits from one account to another
There are often times when it is convenient to have separate Text Marketer accounts within a company but it is...
- REST SMS Gateway API groups resource
groups This blog post has been superseded with our website documentation This resource allows you list send groups. This document is referred...