Build innovative applications that integrate with Msgme

Developer Newsletter

Stay up to date on relevant Msgme Developer news.

Introduction to Widgets

Example of basic Subscription Widget

HOW THEY WORK

A widget is a snippet of code that includes CSS, an HTML form, and a javascript call. They interact with the Msgme suite of APIs to enable subscribers to opt-in to subscription campaigns or submit entries to sweepstakes from a web page. Form fields are validated on submission, and confirmation or error messages are dynamically displayed without page refresh.

Basic installation requires copying a single file to website's web server, placing the widget code into the website page, and setting two variables for keyword and short code.

The look and feel of the web form is completely flexible. Default CSS is supplied, and can be modified or removed to allow seamless integration.

IMPLEMENTATION AND GUIDELINES FOR USE

Widget forms are self-contained and cannot be integrated with other existing web forms, nor can their submission functionality be altered. Javascript is used to perform field validations and display messaging, so any additional javascript that may interfere or interact with the form and elements is not supported.

Default CSS classes are supplied with each widget to set the style of the form. The CSS can remain as-is or altered inline, the classes can be moved into a global CSS file, or removed altogether to allow the site's existing global CSS to style the form.

A javascript call is made to a Javascript file located on msgme.com. This javascript uses Ajax for in-page interactions without page refresh. It is required for the widget to function. It is recommended that the javascript call be made just after the form within the page for optimum results.

For security reasons, to authenticate a legitimate submission a "receiver" file must be placed at the top or "root" level of the website that contains the widget code. For example, if the widget is located on www.website.com/signup/signup_form.htm, the receiver file must be located at www.website.com/xd_receiver.htm.

For detailed instructions and to download the widget code, visit the Subscription Widget or Sweepstakes Widget pages.