A client of ours wanted to integrate webinar purchasing on her Joomla website. She had a GetResponse account where she creates webinars, and she wanted to give her clients the ability to purchase her GetResponse webinars through her website.
Unfortunately, GetResponse does not technically allow either directly or indirectly the purchase of webinars. So, in order to have someone join a webinar, the person with access to the GetResponse account must manually create the contact (if it wasn’t created previously) and then add the contact to the webinar. Of course, this can only be done after charging the contact for the webinar, which was done manually over the phone. Obviously, we needed to automate all that, and so we leveraged the GetResponse API in order to do it.
Our vision was to have the contact visit a form, that (among other fields) displays a dropdown of all the GetResponse webinars, and then, have a payment method (on the same form) that the contact can use to pay for the webinar. Once payment is made and is successful, then the contact is added automatically to the webinar using the API.
So, the first thing that we did was to generate an API key on the GetResponse website (naturally, you will need to have a valid login information in order to do that).
We then downloaded the GetResponse API Client Library from here, and we modified it to accommodate our needs (we mainly added a few functions). The modified client library can be downloaded here. Once downloaded, we extracted the API file to the api folder (a folder which we manually created under the main directory of the Joomla website).
The next step was to download and install RSForm Pro onto the client’s website, and then download and install the RSForm Pro PayPal Plugin. Once that was done, we started creating the form. The form had the following fields: Name, Email, Webinar, rsfp_product, Payment Type, Total to be paid, PayPal, and Pay for Webinar. Here’s a quick explanation of all the fields:
- The Name and the Email field are self-explanatory. They are both of type Textbox.
-
The Webinar was of type Dropdown and it had the following code in the Items field:
if (!function_exists('getResponseWebinars')){ function getResponseWebinars(){ require_once(JPATH_ROOT.'/api/getresponse.php'); $objGetResponse = new GetResponse('your_getresponse_api_key'); $objWebinars = $objGetResponse->getWebinars(); $arrResult = array('|Select Webinar'); foreach ($objWebinars as $webinar){ $arrResult[] = $webinar->webinarId.'__'.$webinar->campaigns[0]->campaignId.'__'.$webinar->name.'|'.$webinar->name; } return $arrResult; } } $ignoreThisValue='<code>';return getResponseWebinars();
The above code dynamically populates the dropdown with all the webinars created in GetResponse. Note: If you are intrigued by the last line in the above code, then check this post for an explanation.
-
The rsfp_product field was of type Single Product and it was used to set the price of the webinar (note: all the webinars had the same price).
-
The Choose Payment field was of type Choose Payment, and it contained an automatically generated list of payment methods. In our case, the only payment method was PayPal.
-
The PayPal field was of type PayPal, and it was necessary to have PayPal as a payment method. Note that the PayPal payment settings are defined in RSForm Pro‘s configuration page (which can be accessed by going to Components -> RSForm! Pro -> Configuration).
-
The Pay for Webinar button was just a submit button.
Once we created the form above, we viewed it (without submitting any data) and it was indeed displaying the webinars in the dropdown.
Now, what remained was to perform the proper actions when a payment is successful. So, we created a plugin called RSFP Payment Success, which implements the rsfp_afterConfirmPayment event, which is triggered when a payment is successful. We added the following code in the rsfp_afterConfirmPayment function:
//get submission information $db = JFactory::getDbo(); $sql = "SELECT FieldName, FieldValue FROM #__rsform_submission_values WHERE SubmissionId='".$SubmissionId."'"; $db->setQuery($sql); $arrResult = $db->loadAssocList(); $arrFinalResult = array(); for ($i = 0; $i < count($arrResult); $i++){ $arrFinalResult[$arrResult[$i]['FieldName']] = $arrResult[$i]['FieldValue']; } //now use the API to add the contact and then tag it require_once(JPATH_ROOT.'/api/getresponse.php'); $objGetResponse = new GetResponse('your_getresponse_api_key'); $strName = $arrFinalResult['Name']; $strEmail = $arrFinalResult['Email']; $strWebinar = $arrFinalResult['Webinar']; $arrWebinar = explode('__', $strWebinar); $strWebinarID = $arrWebinar[0]; $strCampaignID = $arrWebinar[1]; $strWebinarTitle = preg_replace("/[^A-Za-z0-9]/", '', $arrWebinar[2]); // Add the contact and associate it with a campaign $result = $objGetResponse->addContact(array('email'=>$strEmail, 'name'=>$strName, 'campaign'=>array('campaignId'=>$strCampaignID))); //Add the webinar name as a tag if it doesn't exist $webinarGetResponseID = $objGetResponse->getOrCreateTagByName($strWebinarTitle); $resultUpdateContact = $objGetResponse->updateContact($contact_id, array('tags'=>array('tagId'=>$webinarGetResponseID)));
The above code creates the contact if it doesn't exist, then it creates a tag generated from the title of the webinar (also if it doesn't exist), and then tags the contact with the webinar tag. Unfortunately, GetResponse doesn't have any means to add a contact directly to a webinar through the API, hence the workaround with using tags (this means that a slight manual work is required by our client in order to add all contacts with a certain tag to a certain webinar).
Have we had any hiccups with the integration?
Yes - we did. The first major hiccup is the one that we just mentioned, and it is the fact that GetResponse does not have an API method to add a contact to a webinar. We overcame this problem by resorting to tags. It wasn't the most elegant solution, but it was sufficient to the client.
The other major hiccup that we had, is that when a contact is first created in GetResponse, he must verify his account by clicking on a link in a welcome email. If he doesn't do that, then a contact ID will not be generated, and the tagging won't work. This problem, however, was somehow erratic, but, in order to avoid it altogether, we added a row in a table called #__cron_tag_contacts containing the email of the contact and the tag ID when a payment was successful. We then created a small file called tag_contacts.php, which was run by a cron every 15 minutes, and that checked the table for any contacts that were properly verified (e.g. they had an ID in GetResponse). Once a contact gets verified, the script tags it and then deletes its associated row from the table.
We hope that you found this post useful, and that it helped you with your integration with GetResponse. We have tried to provide as much information and guidance as we can about the subject, but, we reckon that the complexity with this integration is a bit high and that some readers may need help with the implementation. If you're one of those readers, then fear not, we are here for you. Just contact us and we'll implement this for you quickly, efficiently, and affordably!