Adding GetResponse subscribers from Quform

Step 1

You should first create the campaign on GetResponse, if you haven’t done so already. We will need your campaign name later.

Step 2

Get your GetResponse API key. At the time of writing, you can find it in My Account » Account Details » API & OAuth

Step 3

Download the GetResponse API PHP class from here. Save the file as GetResponseAPI.class.php into your theme directory at wp-content/themes/YOUR_THEME/.

Step 4

Get the unique ID of the form, see Finding the form ID.

Step 5

Get the unique IDs of the “Name” and “Email” form elements, see Finding the unique element ID.

Step 6

Add the following code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).

1
2
3
4
56789
10
11
12
13
14
15
16
function my_save_to_getresponse($form)
{
    require_once dirname(__FILE__) . '/GetResponseAPI.class.php';
 
    $api = new GetResponse('YOUR_API_KEY');    $campaignName = 'YOUR_CAMPAIGN_NAME';    $subscriberName = $form->getValue('iphorm_3_1');    $subscriberEmail = $form->getValue('iphorm_3_2'); 
    $result =  $api->getCampaigns('EQUALS', $campaignName);
    $campaigns = array_keys((array) $result);
    $campaignId = array_pop($campaigns);
 
    $api->addContact($campaignId, $subscriberName, $subscriberEmail);
}
add_action('iphorm_post_process_3', 'my_save_to_getresponse', 10, 1);
function my_save_to_getresponse($form)
{
    require_once dirname(__FILE__) . '/GetResponseAPI.class.php';

    $api = new GetResponse('YOUR_API_KEY');
    $campaignName = 'YOUR_CAMPAIGN_NAME';
    $subscriberName = $form->getValue('iphorm_3_1');
    $subscriberEmail = $form->getValue('iphorm_3_2');

    $result =  $api->getCampaigns('EQUALS', $campaignName);
    $campaigns = array_keys((array) $result);
    $campaignId = array_pop($campaigns);

    $api->addContact($campaignId, $subscriberName, $subscriberEmail);
}
add_action('iphorm_post_process_3', 'my_save_to_getresponse', 10, 1);

Modify the highlighted lines to suit your form setup and GetResponse settings:

  • On line 5, change YOUR_API_KEY to your GetResponse API key, from Step 2
  • On line 6, change YOUR_CAMPAIGN_NAME to your GetResponse campaign name, from Step 1
  • On line 7, change iphorm_3_2 to the unique ID of the “Name” element in your form, from Step 5
  • On line 8, change iphorm_3_2 to the unique ID of the “Email” element in your form, from Step 5
  • On line 16, change the number 3 on the first line to the unique ID of your Quform form, from Step 4

Still having trouble? Head over to the forums.

Forums