Reputation: 227
I am using aweber gem to add subscribers to aweber list.
I followed all steps needed (create the app, authenticate the app).
The following code can retrieve the required list, but it raises an error (line 6) when attempting to retrieve a subscriber
1: oauth = AWeber::OAuth.new('XXXXXXXXXX', 'XXXXXXXXX')
2: oauth.authorize_with_access('XXXXXXXXXX', 'XXXXXXXXX')
3: aweber = AWeber::Base.new(oauth)
4: list = aweber.account.lists.find_by_name("listname")
5: if list
6: subscriber = list.subscribers.find_by_email("[email protected]")
7: if subscriber.size > 0
8: subscriber.first.last.custom_fields["custom_field"] = "custom_field_value"
9: subscriber.first.last.save
10: else
11: subscriber = {}
12: subscriber["email"] = "[email protected]"
13: subscriber["custom_fields"] = {"custom_field"=>"custom_field_value"}
14: list.subscribers.create(subscriber)
15: end
16: end
Error in log file :
AWeber::ForbiddenRequestError (Method requires extended permissions.):
line : 6.
Upvotes: 1
Views: 241
Reputation: 227
Finally I found the solution, I reset key /secret in the aweber labs app, then Checked the 'Request Subscriber Data' in the app settings BEFORE I authorize the app for the aweber account.
Take a look at :
https://labs.aweber.com/getting_started/public
Last Time I checked it after authorizing the app.
I hope this will help someone.
Upvotes: 1