├── src
├── css
│ └── style.css
├── images
│ ├── logo.png
│ ├── logo_min.png
│ └── logo_medium.png
├── templates
│ ├── template_example.twig
│ └── template_example_array.twig
├── i18n
│ ├── en.json
│ └── ru.json
├── js
│ ├── utils.js
│ └── script.js
├── manifest.json
└── widget.php
├── .gitignore
├── README.md
├── LICENSE
├── package.json
└── gulpfile.js
/src/css/style.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .vscode
2 | bower_components/
3 | node_modules/
4 | dist/
5 | publish/
6 | *.log
7 | *.zip
--------------------------------------------------------------------------------
/src/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grazumkov/amocrm-widget-starter-kit/HEAD/src/images/logo.png
--------------------------------------------------------------------------------
/src/images/logo_min.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grazumkov/amocrm-widget-starter-kit/HEAD/src/images/logo_min.png
--------------------------------------------------------------------------------
/src/images/logo_medium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/grazumkov/amocrm-widget-starter-kit/HEAD/src/images/logo_medium.png
--------------------------------------------------------------------------------
/src/templates/template_example.twig:
--------------------------------------------------------------------------------
1 |
Model.value: {{ model.value|number_format(2, ',', ' ') }}
--------------------------------------------------------------------------------
/src/templates/template_example_array.twig:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/i18n/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "widget":{
3 | "name":"MyWidget",
4 | "short_description":"Short description",
5 | "description":"Full description"
6 | },
7 | "settings":{
8 | "login":"User login",
9 | "api_key":"API key",
10 | "account":"Account"
11 | }
12 | }
--------------------------------------------------------------------------------
/src/js/utils.js:
--------------------------------------------------------------------------------
1 | var utils = {
2 | // custom twig template load example
3 | getTemplate: function (template, callback) {
4 | template = template || '';
5 |
6 | return widget.render({
7 | href:'/templates/' + template + '.twig',
8 | base_path:widget.params.path,
9 | load: callback
10 | },{});
11 | }
12 | };
--------------------------------------------------------------------------------
/src/i18n/ru.json:
--------------------------------------------------------------------------------
1 | {
2 | "widget":{
3 | "name":"Мой виджет",
4 | "short_description":"Короткое описание виджета",
5 | "description":"Полное описание виджета"
6 | },
7 | "settings":{
8 | "login":"Логин",
9 | "api_key":"ключ API",
10 | "account":"Аккаунт"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # AmoCRM Widget Starter Kit
2 | A skeleton of an amocrm widget example https://www.amocrm.ru/developers/content/api/widgets) with Gulp builder
3 |
4 | ## Build script:
5 | * JS files include (gulp-include)
6 | * Remove commets (required for publish)
7 | * Bump manifest version (required for load new version)
8 | * JSON validator - JSONLint
9 | * Javascript errors check - JSHint
10 | * CSS Autoprefixer
11 | * CSS errors check - CSSLint
12 | * Create zip archive to publish
13 |
14 | ## Getting Started
15 |
16 | #### 1. Requires Node and NPM [Download and install node.js](http://nodejs.org/download/).
17 |
18 | #### 2. Clone this repository
19 |
20 | #### 3. Install gulp
21 |
22 | See https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md
23 |
24 | #### 4. Install npm dependencies
25 |
26 | ```sh
27 | $ npm install
28 | ```
29 |
30 | #### 5. Build
31 | ```sh
32 | $ npm run build
33 | ```
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "widget": {
3 | "name": "widget.name",
4 | "description": "widget.description",
5 | "short_description": "widget.short_description",
6 | "code": "xtratio_mywidget",
7 | "secret_key": "1535e67c709408fab94ae09707c5e9202f8e60d7cd7ada60bc2ee9afbe61ace2",
8 | "version": "1.0.3",
9 | "interface_version": 2,
10 | "init_once": false,
11 | "locale": [
12 | "ru",
13 | "en"
14 | ],
15 | "installation": true
16 | },
17 | "locations": [
18 | "comcard-1",
19 | "ccard-1",
20 | "clist-0",
21 | "lcard-1",
22 | "llist-0",
23 | "settings"
24 | ],
25 | "settings": {
26 | "login": {
27 | "name": "settings.login",
28 | "type": "text",
29 | "required": true
30 | },
31 | "api_key": {
32 | "name": "settings.api_key",
33 | "type": "text",
34 | "required": true
35 | },
36 | "account": {
37 | "name": "settings.account",
38 | "type": "text",
39 | "required": true
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "amocrm-widget-starter-kit",
3 | "version": "1.1.0",
4 | "description": "AmoCrm widget build helper",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1",
8 | "build": "gulp build"
9 | },
10 | "repository": {
11 | "type": "git",
12 | "url": "git+https://github.com/xtratio/amocrm-widget-starter-kit.git"
13 | },
14 | "keywords": [
15 | "crm",
16 | "amocrm",
17 | "kit",
18 | "widget"
19 | ],
20 | "author": "xtratio (https://github.com/xtratio)",
21 | "license": "MIT",
22 | "bugs": {
23 | "url": "https://github.com/xtratio/amocrm-widget-starter-kit/issues"
24 | },
25 | "homepage": "https://github.com/xtratio/amocrm-widget-starter-kit#readme",
26 | "devDependencies": {
27 | "del": "^2.2.2",
28 | "jshint": "^2.9.4",
29 | "jshint-stylish": "^2.2.1",
30 | "jsonlint": "^1.6.2",
31 | "semver": "^5.3.0",
32 | "gulp": "^3.9.1",
33 | "gulp-autoprefixer": "^3.1.1",
34 | "gulp-include": "^2.3.1",
35 | "gulp-jshint": "^2.0.4",
36 | "gulp-jsonlint": "^1.1.1",
37 | "gulp-csslint": "^1.0.0",
38 | "gulp-strip-comments": "^2.4.3",
39 | "gulp-util": "^3.0.8",
40 | "gulp-zip": "^4.0.0",
41 | "gulp-json-modify": "^1.0.2"
42 | },
43 | "jshintConfig":{
44 | "globals": {
45 | "define": false
46 | },
47 | "esversion": 5,
48 | "bitwise": true,
49 | "browser": true,
50 | "curly": true,
51 | "eqeqeq": false,
52 | "forin": true,
53 | "immed": true,
54 | "indent": 2,
55 | "latedef": "nofunc",
56 | "newcap": true,
57 | "noarg": true,
58 | "noempty": true,
59 | "nonbsp": true,
60 | "nonew": true,
61 | "strict": false,
62 | "globalstrict": "global",
63 | "sub": true,
64 | "supernew": true,
65 | "undef": true,
66 | "unused": true
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | var gulp = require('gulp'),
4 | gutil = require('gulp-util'),
5 | jshint = require('gulp-jshint'),
6 | jsonlint = require('gulp-jsonlint'),
7 | csslint = require('gulp-csslint'),
8 | zip = require('gulp-zip'),
9 | include = require('gulp-include'),
10 | autoprefixer = require('gulp-autoprefixer'),
11 | strip = require('gulp-strip-comments'),
12 | del = require('del'),
13 | pkg = require('./package'),
14 | manifest = require('./src/manifest'),
15 | jmodify = require("gulp-json-modify"),
16 | semver = require('semver');
17 |
18 | var path = {
19 | src: './src/',
20 | dist: './dist/',
21 | publish: './publish/'
22 | },
23 | zipFileName = 'widget.zip';
24 |
25 | gulp.task('clean', function(){
26 | return del([path.dist+'/**', path.publish+'/**'])
27 | });
28 |
29 | gulp.task('img', ['clean'], function(){
30 | return gulp.src(path.src+"images/**")
31 | .pipe(gulp.dest(path.dist+"images/"))
32 | });
33 |
34 | gulp.task('templates', ['clean'], function(){
35 | return gulp.src(path.src+"templates/**")
36 | .pipe(gulp.dest(path.dist+"templates/"))
37 | });
38 |
39 | gulp.task('jslint', ['clean'], function(){
40 | return gulp.src(path.src+"js/*.js")
41 | .pipe(jshint(pkg.jshintConfig))
42 | .pipe(jshint.reporter('jshint-stylish'))
43 | });
44 |
45 | gulp.task('js', ['jslint'], function(){
46 | return gulp.src(path.src+"js/script.js")
47 | .pipe(include())
48 | .on('error', console.log)
49 | .pipe(strip())
50 | .pipe(gulp.dest(path.dist))
51 | });
52 |
53 | gulp.task('i18n', ['clean'], function(){
54 | return gulp.src(path.src+'i18n/*.json')
55 | .pipe(jsonlint())
56 | .pipe(jsonlint.failOnError())
57 | .pipe(jsonlint.reporter())
58 | .pipe(gulp.dest(path.dist+'i18n/'))
59 | });
60 |
61 | gulp.task('css', ['clean'], function(){
62 | return gulp.src(path.src+'css/style.css')
63 | .pipe(csslint())
64 | .pipe(csslint.formatter("compact"))
65 | .pipe(autoprefixer())
66 | .pipe(gulp.dest(path.dist))
67 | });
68 |
69 | gulp.task('manifest', ['js', 'i18n', 'css', 'img', 'templates'], function(){
70 | return gulp.src(path.src+"manifest.json")
71 | .pipe(jsonlint())
72 | .pipe(jsonlint.failOnError())
73 | .pipe(jsonlint.reporter())
74 | .pipe(jmodify({
75 | key: 'widget.version', value: semver.inc(manifest.widget.version, 'patch', null)
76 | }))
77 | .pipe(gulp.dest(path.src))
78 | .pipe(gulp.dest(path.dist))
79 | });
80 |
81 | gulp.task('zip', ['manifest'], function(){
82 | return gulp.src(path.dist+'**/*.*')
83 | .pipe(zip(zipFileName))
84 | .pipe(gulp.dest(path.publish))
85 | });
86 |
87 | gulp.task('build', ['zip'], function(){
88 | gutil.log(gutil.colors.green('Successfull build: '), gutil.colors.cyan(path.publish+zipFileName));
89 | });
90 |
91 | gulp.task('default', ["build"]);
--------------------------------------------------------------------------------
/src/js/script.js:
--------------------------------------------------------------------------------
1 | define(['jquery'], function($){
2 | var CustomWidget = function () {
3 | var widget = this,
4 | system = widget.system();
5 |
6 | // gulp include example
7 | //=require utils.js
8 |
9 | this.callbacks = {
10 | render: function(){
11 | if (typeof (AMOCRM.data.current_card) != 'undefined' && AMOCRM.data.current_card.id == 0) {
12 | return false; // // do not render on contacts/add || leads/add if needed
13 | }
14 |
15 | // simple layout
16 | var html = 'This is widget example
' +
17 | '';
18 |
19 | widget.render_template({
20 | caption: {
21 | class_name: "xtratio_mywidget"
22 | },
23 | body: html,
24 | render: ''
25 | });
26 |
27 | // template load example 1
28 | utils.getTemplate(
29 | 'template_example',
30 | function(template) {
31 | $('.xtratio_mywidget-wrap').append(
32 | template.render({
33 | model: { value: 12.56 }
34 | }
35 | )
36 | )
37 | });
38 |
39 | // template load example 2
40 | utils.getTemplate(
41 | 'template_example_array',
42 | function(template) {
43 | $('.xtratio_mywidget-wrap').append(
44 | template.render({
45 | id: 'xtratio_mywidget_example_array',
46 | items: [
47 | { id: "example_item_1", url: "#", action: "foo", name: "item 2" },
48 | { id: "example_item_2", url: "#", action: "bar", name: "item 2" }
49 | ]
50 | }
51 | )
52 | )
53 | });
54 |
55 | return true;
56 | },
57 | init: function(){
58 | console.log('init');
59 | return true;
60 | },
61 | bind_actions: function(){
62 | console.log('bind_actions');
63 | return true;
64 | },
65 | settings: function(){
66 | return true;
67 | },
68 | onSave: function(){
69 | alert('click');
70 | return true;
71 | },
72 | destroy: function(){
73 |
74 | },
75 | contacts: {
76 | //select contacts in list and clicked on widget name
77 | selected: function(){
78 | console.log('contacts');
79 | }
80 | },
81 | leads: {
82 | //select leads in list and clicked on widget name
83 | selected: function(){
84 | console.log('leads');
85 | }
86 | },
87 | tasks: {
88 | //select taks in list and clicked on widget name
89 | selected: function(){
90 | console.log('tasks');
91 | }
92 | }
93 | };
94 | return this;
95 | };
96 |
97 | return CustomWidget;
98 | });
--------------------------------------------------------------------------------
/src/widget.php:
--------------------------------------------------------------------------------
1 | account->current(),'account');
16 |
17 | /**
18 | * get methods
19 | * array with available params
20 | */
21 | $params = array(
22 | //'since'=>time()-36000, //since what time get elements (only timestamp)
23 | //'limit'=>10, //limitation of response elements (max 500)
24 | //'offset'=>0, //limit offset
25 | //'id'=>2000308, //take element from account with this id (if this param exists all others are skipping)
26 | //'query'=>'test', //search element by query (you can search by email or phone or any other fields, except notes and tasks
27 | //'type'=>'contact', //or lead - this param only require for notes selection, but also available for tasks
28 | //'element_id'=> 5282604 //contact or lead id - only for notes or tasks selection
29 | //'status'=>array(26264,142), //only for leads - id of lead's statuses you can find in $this->account->current('leads_statuses)
30 | //'responsible_user_id'=>array(52,8), //for contacts,leads and tasks - set additional filter for responsible user(s)
31 |
32 | );
33 | //\Helpers\Debug::vars($this->contacts->get($params),'contacts');
34 | //\Helpers\Debug::vars($this->leads->get($params),'leads');
35 | //\Helpers\Debug::vars($this->tasks->get($params),'tasks');
36 | //\Helpers\Debug::vars($this->notes->get($params), 'notes');
37 | }
38 |
39 | protected function endpoint_set(){
40 |
41 | /**
42 | * contacts set example
43 | */
44 | $request = array(
45 | 'add'=>array(),
46 | 'update'=>array()
47 | );
48 |
49 | $request['add'][] = array(
50 | 'name' => 'test_widget_'.rand(0,9999999),
51 | //'date_create'=>1298904164, //optional
52 | //'last_modified' => 1298904164, //optional
53 | 'linked_leads_id' => array( //array of linked leads ids
54 | 2000309,
55 | 2000042
56 | ),
57 | 'company_name' => 'amowidget',
58 | 'custom_fields' => array(
59 | array(
60 | 'id' => 9536, //custom field id
61 | 'values' => array(
62 | array(
63 | 'value' => rand(0,999).'-'.rand(0,99).'-'.rand(0,99),
64 | //enum for phone,email and im must be symbolic, for others numeric
65 | //(all enums are in account description)
66 | //see $this->account->current('custom_fields')
67 | 'enum' => 'MOB',
68 | ),
69 | array(
70 | 'value' => rand(0,999).'-'.rand(0,99).'-'.rand(0,99),
71 | 'enum' => 'MOB',
72 | ),
73 | array(
74 | 'value' => '7('.rand(0,999).')'.rand(0,999).'-'.rand(0,99).'-'.rand(0,99),
75 | 'enum' => 'HOME',
76 | ),
77 | ),
78 | ),
79 | array(
80 | 'id' => 9540, //custom field id
81 | 'values' => array(
82 | array(
83 | 'value' => rand(0,999).'@mail.com',
84 | //enum for phone,email and im must be symbolic, for others numeric
85 | //(all enums are in account description)
86 | //see $this->account->current('custom_fields')
87 | 'enum' => 'WORK',
88 | ),
89 | array(
90 | 'value' => rand(0,999).'@mail.com',
91 | 'enum' => 'PRIV',
92 | ),
93 | array(
94 | 'value' => rand(0,999).'@mail.com',
95 | 'enum' => 'OTHER',
96 | ),
97 | ),
98 | ),
99 | array(
100 | 'id' => 9538,
101 | 'values' => array(
102 | 0 => array(
103 | 'value' => str_shuffle('qwertyuiopasdfghjklzxcvbnm').' '.rand(0,999999).str_shuffle('qwertyuiopasdfghjklzxcvbnm')
104 | )
105 | )
106 | ),
107 | array(
108 | 'id' => 9534,
109 | 'values' => array(
110 | 0 => array(
111 | 'value' => str_shuffle('qwertyuio\'"pasdfghjklzxcvbnm').'.com'
112 | )
113 | )
114 | ),
115 | //select field must contain value from enums list (ONLY ONE), otherwise api will take first one
116 | array(
117 | 'id' => 334046,
118 | 'values' => array(
119 | 0 => array(
120 | 'value' => 'list3',
121 | )
122 | )
123 | ),
124 | array(
125 | 'id' => 424776,
126 | 'values' => array(
127 | 0 => array(
128 | 'value' => 5555
129 | )
130 | )
131 | ),
132 | )
133 | );
134 |
135 | $request['update'][] = array(
136 | 'id'=>1232810,
137 | 'last_modified'=>time(),//if last modified is lower than in amoCRM DB, then it will not rewrite, but will return what it have
138 | 'responsible_user_id'=>23305,
139 | 'linked_leads_id'=>array(
140 | 199402
141 | )
142 | //other fields fills same as for add
143 | );
144 |
145 | //\Helpers\Debug::vars($this->contacts->set($request));
146 |
147 | /**
148 | * notes set example
149 | */
150 | $request = array(
151 | /*'add'=>array(
152 | array(
153 | 'element_id' => 8000651, //contact/lead id
154 | 'element_type' => $this->_types['contacts'], //contact/lead type - can be found in variable $this->_types['contacts'] or $this->_types['leads']
155 | 'note_type' => 4, //available note's types you can find in $this->account->current('note_types'),
156 | 'date_create'=>time()-360000, //optional field
157 | //'last_modified'=>time(), //optional field
158 | 'text' => 'amowidget note test common '.rand(0,99999)
159 | ),
160 | array(
161 | 'element_id' => 2000309,
162 | 'element_type' => $this->_types['leads'],
163 | 'note_type' => 4,
164 | 'text' => 'amowidget note for lead '.rand(0,99999)
165 | ),
166 | ),*/
167 | 'update'=>array(
168 | array (
169 | 'id' => 1088098,
170 | 'element_id' => 200808,
171 | 'element_type' => $this->_types['leads'],
172 | 'note_type' => 4,
173 | 'last_modified' =>time(), //if last modified is lower than in amoCRM DB, then it will not rewrite, but will return what it have
174 | 'text' => "Test update \n alalalala",
175 | ),
176 | )
177 | );
178 | //\Helpers\Debug::vars($this->notes->set($request));
179 |
180 | /**
181 | * tasks set example
182 | */
183 | $request = array(
184 | 'add'=>array(
185 | array(
186 | 'element_id' => 8000651, //contact/lead id
187 | 'element_type' => $this->_types['contacts'], //contact/lead type - can be found in variable $this->_types['contacts'] or $this->_types['leads']
188 | //'date_create'=>time()-360000, //optional field
189 | //'last_modified'=>time(), //optional field
190 | 'task_type'=>2233, //can be found in $this->account->current('task_types'), can be CALL,LETTER,MEETING or id of task_type
191 | 'text' => 'amowidget task test mmmm custom '.rand(0,99999),
192 | 'complete_till'=>time()-360000
193 | ),
194 | array(
195 | 'element_id' => 2000309,
196 | 'element_type' => $this->_types['leads'],
197 | 'task_type'=>'LETTER',
198 | 'text' => 'amowidget task test LETTER '.rand(0,99999),
199 | 'complete_till'=>time()+3600*24
200 | ),
201 | ),
202 | 'update'=>array(
203 | array (
204 | 'id' => 402362,
205 | 'element_id' => 128962,
206 | 'element_type' => $this->_types['leads'],
207 | 'task_type'=>'MEETING',
208 | 'last_modified' =>time(), //if last modified is lower than in amoCRM DB, then it will not rewrite, but will return what it have
209 | 'text' => 'Meet that guy',
210 | 'complete_till'=>time()+36000
211 | ),
212 | )
213 | );
214 | //\Helpers\Debug::vars($this->tasks->set($request));
215 |
216 | /**
217 | * leads set example
218 | */
219 | $request = array(
220 | 'add'=>array(
221 | array(
222 | 'name' => 'amowidget_phar_'.rand(0,99999),
223 | //'date_create'=>time()-360000, //optional
224 | 'status_id' => 26267, //optional - default first account status - list of statuses $this->account->current('leads_statuses')
225 | 'price' => 500000,
226 | 'custom_fields' => array(
227 | array(
228 | 'id' => 290642,
229 | 'values' => array(
230 | 0 => array(
231 | 'value' => str_shuffle('qwert\'"yuiopasdfghjklzxcvbnm').' '.rand(0,999999).str_shuffle('qwertyuiopasdfghjklzxcvbnm')
232 | )
233 | )
234 | ),
235 | array(
236 | 'id' => 966,
237 | 'values' => array(
238 | 0 => array(
239 | 'value' => str_shuffle('qwertyuiopasdfghjklzxcvbnm').'.com'
240 | )
241 | )
242 | ),
243 | //select field must contain value from enums list (ONLY ONE), otherwise api will take first one
244 | array(
245 | 'id' => 968,
246 | 'values' => array(
247 | 0 => array(
248 | 'value' => 'amocrm_'.rand(0,9999),
249 | )
250 | )
251 | ),
252 | array(
253 | 'id' => 309752,
254 | 'values' => array(
255 | 0 => array(
256 | 'value' => 1
257 | )
258 | )
259 | ),
260 | array(
261 | 'id' => 340947,
262 | 'values' => array(
263 | 0 => array(
264 | 'value' => 'radio3'
265 | )
266 | )
267 | ),
268 | )
269 | ),
270 | ),
271 | 'update'=>array(
272 | array(
273 | 'id'=>2000322,
274 | 'name' => 'amowidget_lead_upd_'.rand(0,9999),
275 | 'status_id' => 142, //optional
276 | 'last_modified' => time(), //if last modified is lower than in amoCRM DB, then it will not rewrite, but will return what it have
277 | 'price' => rand(10000,9999999),
278 | 'custom_fields' => array(
279 | array(
280 | 'id' => 290642,
281 | 'values' => array(
282 | 0 => array(
283 | 'value' => str_shuffle('qwert\'"yuiopasdfghjklzxcvbnm').' '.rand(0,999999).str_shuffle('qwertyuiopasdfghjklzxcvbnm')
284 | )
285 | )
286 | ),
287 | array(
288 | 'id' => 966,
289 | 'values' => array(
290 | 0 => array(
291 | 'value' => str_shuffle('qwertyuiopasdfghjklzxcvbnm').'.com'
292 | )
293 | )
294 | ),
295 | //select field must contain value from enums list (ONLY ONE), otherwise api will take first one
296 | array(
297 | 'id' => 968,
298 | 'values' => array(
299 | 0 => array(
300 | 'value' => 'amocrm_'.rand(0,9999),
301 | )
302 | )
303 | ),
304 | array(
305 | 'id' => 309752,
306 | 'values' => array(
307 | 0 => array(
308 | 'value' => 1
309 | )
310 | )
311 | ),
312 | array(
313 | 'id' => 340947,
314 | 'values' => array(
315 | 0 => array(
316 | 'value' => 'radio3'
317 | )
318 | )
319 | ),
320 | )
321 | )
322 | )
323 | );
324 | //\Helpers\Debug::vars($this->leads->set($request));
325 |
326 | }
327 | }
328 |
--------------------------------------------------------------------------------