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, 5 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

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098