HTML Example

You don't need to be making coding changes to be able to use the Messenger API - forms posted via plain old HTML can be used to easily send text messages.

It is very useful to have a page like this setup during connection testing to assist with isolating problems.

One thing to bear in mind though is that it includes your username and password so we don't recommend making such a page public.

Prepare the code

Open up a text editor and paste the code below:

<!-- URL for SENDING messages only must use POST method-->
<form name="sendSMS" action="" method="post">

<!--Enter recipient in INTERNATIONAL format-->
   <input value="[number INTL format]" name="to">

<!--Message BODY will be form ENCODED-->
   <textarea name="body" rows="4" cols="30">
      [Message Content]

   <input type="reset" value="Clear">
   <input type="submit" value="Send">
<!-- Enter your username and password here -->
   <input type="hidden" name="userId" value="yourusername">
   <input type="hidden" name="password" value="yourpassword">

Save the file as test.html

This form has a basic input for a phone number, a text box for the message content with submit and clear buttons. When the form is submitted it sends directly to the Messenger API endpoint and your SMS text message will be sent to the recipient

Replies are not handled by this example. Replies will be held until collected.

Test the code

  • Open test.html in any web browser and paste the destination mobile number in International Number Format into the To field
  • Enter some body text
  • Click submit

Your message should shortly arrive on the destination handset

Hurray! You have successfully sent your first API Text Message. How easy was that?!