teachbase / amorail Goto Github PK
View Code? Open in Web Editor NEWAmoCRM Rails plugin
License: MIT License
AmoCRM Rails plugin
License: MIT License
Hi @palkan,
It is necessary sometimes to be able to find all entities using limit_rows
and limit_offset
or to search by type
.
For now I use the following dirty solution:
Amorail::Lead.instance_eval do
def list(params = {})
response = client.safe_request(
:get,
remote_url('list'),
**params
)
load_many(response)
end
end
I would like to have a method with similar functionality out of the box.
We can name some more AR-like, for instance, where
.
What do you think?
Сейчас уже не открывается старая документация, пока что еще осталась английская версия, хоть на этом спасибо, но вот с русской проблема.
Добавьте пожалуйста возможность доставать контакт из сделки
Hi @palkan,
seems like you forgot to push 0.3.1 tag.
Or is it done intentionally?
Есть n аккаунтов амо, во все нужно писать события. Есть ли сейчас возможность обойтись без config, а задавать
usermail: '[email protected]'
api_key: '75742b166417fe32ae132282ce178cf6'
api_endpoint: 'https://test.amocrm.ru'
динамически.
Hi @palkan,
Today I have faced with an issue:
Amorail::Lead.find ANY_NONEXISTENT_ID
=> false
I don't it is convenient to return false
from #find
because one waits for lead instance (if given lead is exists) or nil
.
It seems like it occurs because of Entity#handle_response
returns false
.
My proposal is to return nil
instead of false
.
What do you think?
Привет,
Я завёл в CRM интеграцию.
Получил из админки Secret Key.
Дальше передаю имейл пользователя-админа, Secret Key (как API key), endpoint.
(Integration, Authorization коды, которые выдаёт админка, не использую.)
И получаю Not Authenticated.
Буду благодарен за помощь!
Hi.
Sorry to trouble you, but have an issue with custom fields, that not clear for me.
So from you guide I understand that I need to add custom fields in secrets.yaml.
"AmoCRM is using "custom_fields" architecture, to get all information for your account, you can find properties and set up configuration manually in config/secrets.yml."
I make a lot of attempts with no luck.
In final I got this secrets yaml:
amorail:
usermail: 'myusername'
api_key: 'mytoken'
api_endpoint: 'myAMOdomain'
custom_fields:
contacts:
-
id: "1628873"
name: "user_hash"
code: ""
multiple: "N"
type_id: "1"
disabled: "0"
-
id: "1634385"
name: "lp_db_id"
code: ""
multiple: "N"
type_id: "2"
disabled: "0"
And still have problems with as example get Contact.
Amorail::Contact.find_by_query("[email protected]")
=> [#<Amorail::Contact:0x007fc019f909a8 @last_modified=1435166323, @id=65601902, @name="test", @date_create=1435166279, @responsible_user_id=271104, @company_name="", @linked_company_id="0", @email="[email protected]">]
So we got Contact but without lp_db_id
Amorail::Contact.find_by_query("[email protected]")
=> key not found: "code"
In this case we got an error.
What I'm doing wrong? Thinks that may be something not good in yaml file.
Thanks.
Привет! Подскажите пожалуйста, как отправлять кастомные поля при создании lead?
Мой пример не работает(
Если не указывать поле custom_fields все работает отлично.
У моего поля тип "Текст".
lead = Amorail::Lead.new(
name: "Example Lead",
tags: "IT, Sales",
price: 100,
status_id: Amorail.properties.leads.statuses[
Rails.application.secrets.amoparams['lead_status']
].id,
custom_fields: [{
:id => '1778775',
:values => ['test']
}]
)
lead.save!
Привет, настроил отправку новых записей из приложения в АМО, на локальной машине все работает и напрямую и через воркер, на продакшн сервере выдает ошибку
undefined method `+' for nil:NilClass
вот сам код
contact = AmoContact.new(
name: @customer.name + " " + @customer.surname,
phone: @customer.phone,
bday: @customer.bday,
address: @customer.address
)
contact.save!
Вот эта строчка не при чем:
name: @customer.name + " " + @customer.surname,
в переменных тоже 100% есть данные, вот хеш с параметрами с той же страницы, что и ошибка
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"jCgmFBsn2GBK/uq+GbkOPztzExIlcq/qtxmtvg7tTBn0e57pu2V+NvlUBVZ655ZXdV2l16LV1nRL0YlzffufBw==",
"customer"=>{"name"=>"Aleksey", "surname"=>"Paschenko", "phone"=>"********", "address"=>"Bogatyrova", "job"=>"", "diler"=>"0", "bday"=>"26.07.2017", "note"=>""},
"commit"=>"Create Customer"}
ругается на contact.save!
А как быть с полями на русском? Дополнительное amo_property :xxx не думаю что справится. Есть ли сейчас поддержка кастомных полей на русском?
Они сейчас поменяли систему авторизации на oAuth, я хочу реализовать в геме упрощенный вариант, думаю как лучше сделать, сейчас сохраняю access_token
и refresh_token
в файл, затем проверяем не протух ли токен и в случае надобности - обновляем его. Но думаю может лучше добавить настройку и например, связывать гем с базой приложения, и коды напрямую записывать туда?
Нахожу сделку.
lead = Amorail::Lead.find LEAD_ID
Хочу поменять два параметра (responsible_user_id
и status_id
).
Пытаюсь это сделать двумя способами.
Оба способа падают с ошибками.
lead.update! responsible_user_id: MANAGER_ID, status_id: STATUS_ID
#=> Amorail::Entity::NotPersisted: Amorail::Entity::NotPersisted
# or
lead.responsible_user_id = MANAGER_ID
lead.status_id = STATUS_ID
lead.save!
#=> Amorail::Entity::InvalidRecord: Amorail::Entity::InvalidRecord
В какую сторону смотреть?
Добрый день, возможно вы забыли добавить тег на свежую версию) Пробовали с коллегой стягивать гем и он был без авторизации oauth, версия шла 0.6.1. Стянулось свежее, только когда гвоздями ветку master прописала.
Hi @palkan,
recently I received a response with status 200 but there was errors inside
{"response"=>{"leads"=>{"update"=>{"errors"=>{"1572277"=>"Last modified date is older than in database"}}}, "server_time"=>1499868971}}
I just didn't specify last_modified
attribute on update.
The problem is really tricky because one receives 200 (and Amorail treats it as a successful response) but object is not actually saved.
What do you think, can we deal with it somehow?
Amorail работает с данным функционалом? Если нет, то можно добавить, а то крайне нужна вещь :)
I'm getting this error message:
RAILS_ENV=test bundle exec rspec spec/requests/home_applications_spec.rb -e "GET /score/"
/home/manuel/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'amorail'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant Amorail::Lead
The Amorail:Lead is called from the ops_lead.rb file. Even if add "require 'amorail'" to the file the code works fine on development and production but no when I try to run a test.
UPDATE
We can close this one. All was an error in my PATH.
Уже некоторое время я стал постоянно получать Amorail::AmoBadRequestError на любые запросы.
Буду благодарен за любую помощь.
Добавьте пожалуйста сабж
Мне нужно изменить несколько сделок (или создать несколько задач).
lead_1 = Amorail::Lead.find 1
# some modifications
lead.save
lead_2 = Amorail::Lead.find 2
# some modifications
lead.save
В данном примере будет два (два же?) запроса к AmoCRM API
.
Можно ли данные запросы объединить в один?
AmoCRM API
поддерживает мультиизменение в одном запросе.
Поддерживает ли сие Amorail?
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.