Closed shivabhusal closed 8 years ago
Also, please let me know how can I find id of any subscriber from its "name"? I need to change the status
of the subscriber
Status of a subscriber can be one of ["subscribed", "unsubscribed", "unconfirmed]. (https://labs.aweber.com/docs/reference/1.0#subscriber_entry)
You can also search for a subscriber by name at the account level using the findsubscribers method (https://labs.aweber.com/docs/reference/1.0#account_entry). If you know the list then use the find on the subscriber collection instead (https://labs.aweber.com/docs/reference/1.0#subscriber_collection) it is a much faster search and is the recommended method.
For further questions, check out the documentation at labs.aweber.com
ok thanks,
and how can I find any subscriber from a list using its email
?? using your gem .. please paste some useful code snippet if possible @amberheilman
require "aweber"
oauth = AWeber::OAuth.new("<CONSUMER_KEY>", "<CONSUMER_SECRET>")
oauth.authorize_with_access("<ACCESS_TOKEN>", "<ACCESS_SECRET>")
aweber = AWeber::Base.new(oauth)
subscriber = aweber.account.lists[<LIST_ID>].subscribers.find_by_name("John Doe")
puts "Subscriber ID: #{subscriber.id}"
puts "Subscriber Status: #{subscriber.status}"
subscriber.status = "unsubscribed"
subscriber.save()
updated_subscriber = aweber.account.lists[<LIST_ID>].subscribers.find_by_email("johndoe@email.com")
print "Updated Subscriber #{updated_subscriber.name}'s status to: #{updated_subscriber.status}"
I tried
oauth = AWeber::OAuth.new(ENV['AWEBER_APP_CONSUMER_KEY'], ENV['AWEBER_APP_CONSUMER_SECRET_KEY'])
#Rather than authorizing with the verification code, we use the token and secret
oauth.authorize_with_access(ENV['AWEBER_APP_ACCESS_TOKEN'], ENV['AWEBER_APP_ACCESS_TOKEN_SECRET'])
@aweber = AWeber::Base.new(oauth)
and to access/find the subscriber I tried
@aweber.account.lists[4026123].subscribers.find_by_email('my.email@gmail.com')
=> []
am I doing something wrong? @amberheilman
ok I found what I am doing wrong.. I have written in this blog https://cbabhusal.wordpress.com/2015/12/13/aweberforbiddenrequesterror-method-requires-extended-permissions/
Context:
Updateable Subscribers
name misc_notes email status last_followup_message_number_sent custom_fields (Hash of key/value pairs) ad_tracking
Question: what are the possible values I can send from my app for the field
status
?