Rails - adding custom subscriber data

Hi,

Struggling with adding some custom data to a subscriber in my Rails app.

The code below successfully adds a subscriber but the custom field remains empty ...

Net::HTTP.post_form(URI.parse('http://api.createsend.com/api/api.asmx/Subscriber.Add'),
                {'ApiKey' => @apikey,
                'ListID' => '****542a6aa975b66df5a6f0f*****',
                'Email' =>email,
                'CustomFields' => {'Key' => 'Industry Type', ' Value' => @industry},
                'Name' => name})

Any help greatly appreciated, deadline for completion is today!

Cheers,

Richard
www.creativetechnologist.co.uk

jamesd jamesd, 6 years ago

It looks as though the key for your custom field is incorrect. You should use the key as defined in the output when you get the results of a call to: http://www.campaignmonitor.com/api/lists/#getting_list_custom_fields

Also, you might be interested in using the following gem rather than posting directly: https://rubygems.org/gems/createsend

200,000 companies around the world can't be wrong.

From Australia to Zimbabwe, and everywhere in between, companies count on 
Campaign Monitor for email campaigns that drive real business results.

Get started for free
1-888-533-8098