ekyfauzi / active-campaign-rails Goto Github PK
View Code? Open in Web Editor NEWSimple wrapper for ActiveCampaign API
Home Page: https://rubygems.org/gems/active-campaign-rails
License: MIT License
Simple wrapper for ActiveCampaign API
Home Page: https://rubygems.org/gems/active-campaign-rails
License: MIT License
I'm getting this error repeatedly whenever an contact_sync is attempted. I've narrowed it down to this API call, but I can't figure out what's causing it.
Having an issue where params are not making their way to the system in AC.
Note: the connection works fine, it's submitting the contact, just not all the fields. Fields not making it into the system state, role/position, organization - and the contact is not being added to any listโ there is a list number 3, there is a state, org (account name), and role/position within the admin tool.
def activecampaign_connect
ac = ActiveCampaign.new(
api_endpoint: ENV['ACTIVE_CAMPAIGN_API_URL'],
api_key: ENV['ACTIVE_CAMPAIGN_API_KEY']
)
return ac
end
def activecampaign_add_dotm_user( first_name, last_name, email, org, position, state )
# connect to api..
ac = activecampaign_connect
# add user to dotm email list..
# response = ac.contact_add(
response = ac.contact_sync(
first_name: first_name,
last_name: last_name,
email: email,
roleposition: position,
role_position: position,
state: state,
'field[%ACCT_NAME%,0]' => org,
'field[%ROLEPOSITION%,0]' => position,
'field[%STATE%,0]' => state,
'p[3]' => 3,
)
puts response
end
A test API call on my end and this worked as expected.
Here's the request URL I used:
https://edumotion.api-us1.com/admin/api.php?api_action=contact_sync&api_key=YOUR_API_KEY_HERE
And here's the body of the request (I replicated what I'm seeing in your code, in that screenshot you sent):
first_name=Pedro&last_name=from ActiveCampaign&[email protected]&roleposition=position&role_position=position&state=state&field[%ACCT_NAME%,0]=org&field[%ROLEPOSITION%,0]=position&field[%STATE%,0]=state&p[3]=3
I've read the documentation but I keep running into problems. In the official API documentation, it says to use p[#]: #
(where #
is the list ID) to add the contact to a list. However, Rails won't accept that.
Here's what I use:
active_campaign.contact_sync(
email: 'EMAIL-ADDRESS-HERE',
p[3]: '3'
)
Here's the error I receive:
syntax error, unexpected ':', expecting =>
p[3]: '3'
If I replace :
with =>
, I receive:
NoMethodError: undefined method `[]' for nil:NilClass
I suspect the same issue would occur with any other bracket-using variable.
organizations_list no longer exists. Instead need to add functionality for accessing accounts.
Hi team,
The latest version is causing an error to be thrown:
client.list_list(ids: 'all')
NameError: uninitialized constant ActiveCampaign::RestClient
from /Users/lcp/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/active-campaign-rails-0.2.2/lib/active-campaign-rails.rb:40:in `method_missing'
0.2.1 works fine
Hi,
I'm using your gem and I got stuck at some point.
This is the code I use to verify user account on ActiveCampaign exists:
#1 def test_active_campaign(params)
#2 verified = false
#3 if params[:user][:ac_api_endpoint].present? && params[:user][:ac_api_key].present?
#4 require 'active-campaign-rails'
#5 active_campaign = ActiveCampaign.new(
#6 api_endpoint: params[:user][:ac_api_endpoint],
#7 api_key: params[:user][:ac_api_key])
#8 result = eval active_campaign.account_view
#9 verified = true if result[:result_code] == 1
#10 end
#11 verified
#12 end
Unfortunately I keep this getting this error TypeError (can't dup NilClass):
for line #8.
Do you know why this happens?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.