Aweber Integration

This guide assumes you have nothing previously setup to work with the AWeber API. It will walk through registering an account, creating an app and everything up to the point where you’ll actually start working with data.

If you don’t want to bother with all the account setup stuff, you can look in the examples directory for just example code.

1. Register an AWeber Labs Account

Head to and sign up for a free AWeber Labs account. This is how you register apps and get OAuth keys.

2. Create an App

Once logged in, Create a New App. Once created, it will show you the Consumer Key and Secret for that app.

3. Write Some Code

The OAuth Handler

oauth ='consumer_key', 'consumer_secret')

Authorize an Account

Open, what the following outputs, in a browser and use your AWeber account credentials. This will give your app permission to work with your account’s data:


If you go to that URL you will see

This form will only authenticate your app to access the lists and count of subscribers but not subscriber details. You cannot access names, email, etc of subscribers





This form shows that the app is willing to access some more details of the subscribers too. With this type of access form; your app can access the subscriber details too and you can search any customer details using API


A callback url may also be passed by setting the :oauth_callback parameter:

oauth.request_token(:oauth_callback => '').authorize_url

For more details about Authorization, see

Verification Code

After you do the above step, it will output a “Verification Code”. Copy this and verify your oauth object:


Grab an AWeber::Base

aweber =

This object is how you access data from your account. aweber.account is your account object which is the stem for all other resources.

What if I don’t want to verify every time?

After verifying once, the oauth object contains an oauth.access_token.token and and oauth.access_token.secretwhich may be used to authorize your application without having to verify via url:

puts 'Access token: ' + oauth.access_token.token
puts 'Access token secret: ' + oauth.access_token.secret

The token and secret can then be saved, and authorization can be performed as follows:

require 'aweber'
oauth ='consumer_key', 'consumer_secret')
#Rather than authorizing with the verification code, we use the token and secret
oauth.authorize_with_access(YOUR_ACCESS_TOKEN, YOUR_ACCESS_TOKEN_SECRET)
aweber =





Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s