mysendingbox 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +505 -148
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,315 +1,672 @@
1
+
1
2
  # mysendingbox-node
2
3
 
4
+
5
+
3
6
  [downloads-image]: http://img.shields.io/npm/dm/mysendingbox.svg
7
+
4
8
  [npm-url]: https://npmjs.org/package/mysendingbox
9
+
5
10
  [npm-image]: https://badge.fury.io/js/mysendingbox.svg
6
11
 
7
- [![NPM version][npm-image]][npm-url] [![Dependency Status](https://gemnasium.com/badges/github.com/exaland/mysendingbox-node.svg)](https://gemnasium.com/github.com/exaland/mysendingbox-node)
12
+
8
13
 
14
+ [![NPM version][npm-image]][npm-url] [![Dependency Status](https://gemnasium.com/badges/github.com/exaland/mysendingbox-node.svg)](https://gemnasium.com/github.com/exaland/mysendingbox-node)
9
15
 
16
+
17
+
18
+
10
19
 
11
20
  MySendingBox.com Node.js Client is a simple but flexible wrapper for the [MySendingBox.fr](https://www.mysendingbox.fr) API.
12
21
 
22
+
23
+
13
24
  See full Seeuletter.com documentation [here](https://docs.mysendingbox.fr/).
14
25
 
26
+
27
+
15
28
  For best results, be sure that you're using the latest version of the Seeuletter API and the latest version of the Node.js wrapper.
16
29
 
30
+
31
+
17
32
  #### French
33
+
18
34
  Un module NPM pour envoyer du courrier postal ou electronique en ligne depuis votre application Node.Js.
19
35
 
36
+
37
+
20
38
  Seeuletter propose une API permettant d'envoyer très facilement du courrier postal ou électronique depuis votre ERP, CRM ou application web.
21
39
 
40
+
41
+
22
42
  Pas de frais d'installation. Pas d'engagement. Vous payez ce que vous consommez.
23
43
 
44
+
45
+
24
46
  Documentation : https://docs.mysendingbox.fr/
25
47
 
48
+
49
+
26
50
  Bien démarrer : https://www.mysendingbox.fr/guide/bien-demarrer-avec-l-api-d-envoi-de-courrier
27
51
 
52
+
53
+
28
54
  ## Table of Contents
29
55
 
56
+
57
+
30
58
  - [Getting Started](#getting-started)
31
- - [Registration](#registration)
32
- - [Installation](#installation)
33
- - [Letters](#letters)
34
- - [Postcards](#postcards)
35
- - [Accounts](#accounts)
36
- - [Invoices](#invoices)
59
+
60
+ - [Registration](#registration)
61
+
62
+ - [Installation](#installation)
63
+
64
+ - [Letters](#letters)
65
+
66
+ - [Postcards](#postcards)
67
+
68
+ - [Price](#price) **new update**
69
+
70
+ - [Accounts](#accounts)
71
+
72
+ - [Invoices](#invoices)
73
+
37
74
  - [Examples](#examples)
38
75
 
76
+
77
+
39
78
  ## Getting Started
40
79
 
80
+
81
+
41
82
  Here's a general overview of the Seeuletter services available, click through to read more.
42
83
 
84
+
85
+
43
86
  Please read through the official [API Documentation](https://docs.mysendingbox.fr/) to get a complete sense of what to expect from each endpoint.
44
87
 
88
+
89
+
45
90
  ### Registration
46
91
 
92
+
93
+
47
94
  First, you will need to first create an account at [Seeuletter.com](https://www.mysendingbox.fr/signup) and obtain your Test and Live API Keys.
48
95
 
96
+
97
+
49
98
  Once you have created an account, you can access your API Keys from the [Settings Panel](https://www.mysendingbox.fr/app/dashboard/keys).
50
99
 
100
+
101
+
51
102
 
52
103
  ### Installation
53
104
 
105
+
106
+
54
107
  mysendingbox-node can be installed through the npm:
55
108
 
109
+
110
+
56
111
  ```
112
+
57
113
  $ npm install -S mysendingbox
114
+
58
115
  ```
59
116
 
117
+
118
+
60
119
  To build and install from the latest source:
61
120
 
121
+
122
+
62
123
  ```
124
+
63
125
  $ git clone git@github.com:exaland/mysendingbox-node.git
126
+
64
127
  $ npm install
128
+
65
129
  ```
66
130
 
131
+
132
+
67
133
  ### Letters
68
134
 
135
+
136
+
69
137
  #### Create a new letter - Callback style
138
+
70
139
  ```javascript
71
- var Seeuletter = require('seeuletter')('YOUR API KEY');
140
+
141
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
142
+
143
+
72
144
 
73
145
  // callback pattern
146
+
74
147
  Seeuletter.letters.create({
75
- description: 'Test Letter from the Node.js Wrapper',
76
- to: {
77
- name: 'Erlich',
78
- address_line1: '30 rue de rivoli',
79
- address_line2: '',
80
- address_city: 'Paris',
81
- address_country: 'France',
82
- address_postalcode: '75004'
83
- },
84
- postage_type: 'prioritaire',
85
- color: 'bw',
86
- source_file: '<html>Hello, {{nom}}</html>',
87
- source_file_type: 'html',
88
- variables: {
89
- nom : 'Seeuletter'
90
- }
91
- }, function (err, body) {
92
- if (err) console.log('err : ' , err.message);
93
- console.log('body : ', body)
148
+
149
+ description: 'Test Letter from the Node.js Wrapper',
150
+
151
+ to: {
152
+
153
+ name: 'Erlich',
154
+
155
+ address_line1: '30 rue de rivoli',
156
+
157
+ address_line2: '',
158
+
159
+ address_city: 'Paris',
160
+
161
+ address_country: 'France',
162
+
163
+ address_postalcode: '75004'
164
+
165
+ },
166
+
167
+ postage_type: 'prioritaire',
168
+
169
+ color: 'bw',
170
+
171
+ source_file: '<html>Hello, {{nom}}</html>',
172
+
173
+ source_file_type: 'html',
174
+
175
+ variables: {
176
+
177
+ nom : 'Seeuletter'
178
+
179
+ }
180
+
181
+ }, function (err, body) {
182
+
183
+ if (err) console.log('err : ' , err.message);
184
+
185
+ console.log('body : ', body)
186
+
94
187
  })
188
+
95
189
  ```
96
190
 
191
+
192
+
97
193
  #### Create a new letter - Promise style
98
194
 
195
+
196
+
99
197
  ```javascript
100
- var Seeuletter = require('seeuletter')('YOUR API KEY');
198
+
199
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
200
+
201
+
101
202
 
102
203
  // promise pattern
204
+
103
205
  Seeuletter.letters.create({
104
- description: 'Test Letter from the Node.js Wrapper',
105
- to: {
106
- name: 'Erlich',
107
- address_line1: '30 rue de rivoli',
108
- address_line2: '',
109
- address_city: 'Paris',
110
- address_country: 'France',
111
- address_postalcode: '75004'
112
- },
113
- postage_type: 'prioritaire',
114
- color: 'bw',
115
- source_file: '<html>Hello, {{nom}}</html>',
116
- source_file_type: 'html',
117
- variables: {
118
- nom : 'Seeuletter'
119
- }
206
+
207
+ description: 'Test Letter from the Node.js Wrapper',
208
+
209
+ to: {
210
+
211
+ name: 'Erlich',
212
+
213
+ address_line1: '30 rue de rivoli',
214
+
215
+ address_line2: '',
216
+
217
+ address_city: 'Paris',
218
+
219
+ address_country: 'France',
220
+
221
+ address_postalcode: '75004'
222
+
223
+ },
224
+
225
+ postage_type: 'prioritaire',
226
+
227
+ color: 'bw',
228
+
229
+ source_file: '<html>Hello, {{nom}}</html>',
230
+
231
+ source_file_type: 'html',
232
+
233
+ variables: {
234
+
235
+ nom : 'Seeuletter'
236
+
237
+ }
238
+
120
239
  })
121
- .then(function (response) {
122
- console.log('response : ', response);
240
+
241
+ .then(function (response) {
242
+
243
+ console.log('response : ', response);
244
+
123
245
  })
124
- .catch(function (err) {
125
- console.log('err : ', err);
246
+
247
+ .catch(function (err) {
248
+
249
+ console.log('err : ', err);
250
+
126
251
  });
252
+
127
253
  ```
128
254
 
255
+
256
+
129
257
  #### Create a new electronic letter - Promise style
130
258
 
259
+
260
+
131
261
  ```javascript
132
- var Seeuletter = require('seeuletter')('YOUR API KEY');
262
+
263
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
264
+
265
+
133
266
 
134
267
  // promise pattern
268
+
135
269
  Seeuletter.letters.createElectronic({
136
- description: 'Test electronic letter from the Node.js Wrapper',
137
- to: {
138
- email: 'erlich.dumas@example.com',
139
- first_name: 'Erlich',
140
- last_name: 'Dumas',
141
- status: 'individual'
142
- },
143
- postage_type: 'lre',
144
- content: 'Please review the attached documents:',
145
- source_file: '<html>Hello, {{nom}}</html>',
146
- source_file_type: 'html',
147
- variables: {
148
- nom : 'Seeuletter'
149
- }
270
+
271
+ description: 'Test electronic letter from the Node.js Wrapper',
272
+
273
+ to: {
274
+
275
+ email: 'erlich.dumas@example.com',
276
+
277
+ first_name: 'Erlich',
278
+
279
+ last_name: 'Dumas',
280
+
281
+ status: 'individual'
282
+
283
+ },
284
+
285
+ postage_type: 'lre',
286
+
287
+ content: 'Please review the attached documents:',
288
+
289
+ source_file: '<html>Hello, {{nom}}</html>',
290
+
291
+ source_file_type: 'html',
292
+
293
+ variables: {
294
+
295
+ nom : 'Seeuletter'
296
+
297
+ }
298
+
150
299
  })
151
- .then(function (response) {
152
- console.log('response : ', response);
300
+
301
+ .then(function (response) {
302
+
303
+ console.log('response : ', response);
304
+
153
305
  })
154
- .catch(function (err) {
155
- console.log('err : ', err);
306
+
307
+ .catch(function (err) {
308
+
309
+ console.log('err : ', err);
310
+
156
311
  });
312
+
157
313
  ```
158
314
 
315
+
316
+
159
317
  #### List all Letters
160
318
 
319
+
320
+
161
321
  ```javascript
162
- var Seeuletter = require('seeuletter')('test_12345678901234567890')
322
+
323
+ var Seeuletter = require('seeuletter')('test_12345678901234567890')
324
+
325
+
163
326
 
164
327
  Seeuletter.letters.list()
165
- .then(function (response) {
166
- console.log('response : ', response);
328
+
329
+ .then(function (response) {
330
+
331
+ console.log('response : ', response);
332
+
167
333
  })
168
- .catch(function (err) {
169
- console.log('err : ', err);
334
+
335
+ .catch(function (err) {
336
+
337
+ console.log('err : ', err);
338
+
170
339
  });
340
+
171
341
  ```
172
342
 
343
+
344
+
173
345
  #### Retrieve a specific Letter
174
346
 
347
+
348
+
175
349
  ```javascript
176
- var Seeuletter = require('seeuletter')('test_12345678901234567890')
350
+
351
+ var Seeuletter = require('seeuletter')('test_12345678901234567890')
352
+
353
+
177
354
 
178
355
  Seeuletter.letters.retrieve('LETTER_ID')
179
- .then(function (response) {
180
- console.log('response : ', response);
356
+
357
+ .then(function (response) {
358
+
359
+ console.log('response : ', response);
360
+
181
361
  })
182
- .catch(function (err) {
183
- console.log('err : ', err);
362
+
363
+ .catch(function (err) {
364
+
365
+ console.log('err : ', err);
366
+
184
367
  });
368
+
185
369
  ```
186
370
 
371
+
372
+
187
373
  ### Postcards
188
374
 
375
+
376
+
189
377
  #### Create a new postcard - Promise style
190
378
 
379
+
380
+
191
381
  ```javascript
192
- var Seeuletter = require('seeuletter')('YOUR API KEY');
382
+
383
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
384
+
385
+
193
386
 
194
387
  // Create the address
388
+
195
389
  Seeuletter.postcards.create({
196
- description: 'Test Postcard from the Node.js Wrapper',
197
- to: {
198
- name: 'Erlich',
199
- address_line1: '30 rue de rivoli',
200
- address_line2: '',
201
- address_city: 'Paris',
202
- address_country: 'France',
203
- address_postalcode: '75004'
204
- },
205
- // https://www.mysendingbox.fr/templates
206
- source_file_front: 'YOUR TEMPLATE ID',
207
- source_file_front_type: 'template_id',
208
- source_file_back: 'YOUR TEMPLATE ID',
209
- source_file_back_type: 'template_id',
210
-
211
- variables: {
212
- PRENOM: 'Erlich',
213
- NOM: 'Bachman',
214
- CODE_PROMO_BIENVENUE: 'CODE',
215
- URL_COURTE_BIENVENUE: 'https://goo.gl/uqTHnD',
216
- ADRESSE: '30 rue de Rivoli',
217
- CODE_POSTAL : '75004',
218
- VILLE : 'Paris',
219
- PAYS : 'France'
220
- }
390
+
391
+ description: 'Test Postcard from the Node.js Wrapper',
392
+
393
+ to: {
394
+
395
+ name: 'Erlich',
396
+
397
+ address_line1: '30 rue de rivoli',
398
+
399
+ address_line2: '',
400
+
401
+ address_city: 'Paris',
402
+
403
+ address_country: 'France',
404
+
405
+ address_postalcode: '75004'
406
+
407
+ },
408
+
409
+ // https://www.mysendingbox.fr/templates
410
+
411
+ source_file_front: 'YOUR TEMPLATE ID',
412
+
413
+ source_file_front_type: 'template_id',
414
+
415
+ source_file_back: 'YOUR TEMPLATE ID',
416
+
417
+ source_file_back_type: 'template_id',
418
+
419
+
420
+
421
+ variables: {
422
+
423
+ PRENOM: 'Erlich',
424
+
425
+ NOM: 'Bachman',
426
+
427
+ CODE_PROMO_BIENVENUE: 'CODE',
428
+
429
+ URL_COURTE_BIENVENUE: 'https://goo.gl/uqTHnD',
430
+
431
+ ADRESSE: '30 rue de Rivoli',
432
+
433
+ CODE_POSTAL : '75004',
434
+
435
+ VILLE : 'Paris',
436
+
437
+ PAYS : 'France'
438
+
439
+ }
440
+
441
+ })
442
+
443
+ .then(function (letter) {
444
+
445
+ console.log('The Seeuletter API Postcard responded : ', letter)
446
+
447
+ })
448
+
449
+ .catch(function (err) {
450
+
451
+ console.log('Error message : ', err.message)
452
+
221
453
  })
222
- .then(function (letter) {
223
- console.log('The Seeuletter API Postcard responded : ', letter)
224
- })
225
- .catch(function (err) {
226
- console.log('Error message : ', err.message)
227
- })
454
+
455
+
228
456
 
229
457
  ```
458
+ ### Price
459
+
460
+
461
+
462
+ #### Get Price for MySendingBox- Promise style
463
+
464
+
465
+
466
+ ```javascript
467
+
468
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
469
+
470
+
471
+
472
+ // Get the Letter Price
473
+ Seeuletter.LettersPrice.getPrice({
474
+
475
+ // Letter type
476
+
477
+ postage_type: 'ecopli',
478
+
479
+ page_count: 11,
480
+
481
+ channel: 'paper',
482
+
483
+ color: 'color',
484
+
485
+ pack: 'business',
486
+
487
+ both_sides: false,
488
+
489
+ postage_speed: 'express'
490
+
491
+ }).then(function (response) {
492
+
493
+ console.log('[Get Price] The Seeuletter API responded : ', response)
494
+
495
+ }).catch(function (err) {
496
+
497
+ console.log('[Get Price] Error message : ', err.message)
498
+
499
+ console.log('[Get Price] Error status_code : ', err.status_code)
500
+
501
+ })
502
+ ```
230
503
 
231
504
  ### Accounts
232
505
 
506
+
507
+
233
508
  #### Create a new account for the company
234
509
 
510
+
511
+
235
512
  ```javascript
236
- var Seeuletter = require('seeuletter')('YOUR API KEY');
513
+
514
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
515
+
516
+
237
517
 
238
518
  // Create the account
519
+
239
520
  Seeuletter.accounts.create({
240
- email: "msb.partner@example.com",
241
- name: "Erlich Bachman",
242
- phone: "+33104050607",
243
- company_name: "MSB Partner",
244
- address_line1: '30 rue de rivoli',
245
- address_line2: '',
246
- address_city: 'Paris',
247
- address_country: 'France',
248
- address_postalcode: '75004'
521
+
522
+ email: "msb.partner@example.com",
523
+
524
+ name: "Erlich Bachman",
525
+
526
+ phone: "+33104050607",
527
+
528
+ company_name: "MSB Partner",
529
+
530
+ address_line1: '30 rue de rivoli',
531
+
532
+ address_line2: '',
533
+
534
+ address_city: 'Paris',
535
+
536
+ address_country: 'France',
537
+
538
+ address_postalcode: '75004'
539
+
249
540
  })
250
- .then(function (account) {
251
- console.log('The Seeuletter API Account responded : ', account)
252
- })
253
- .catch(function (err) {
254
- console.log('Error message : ', err.message)
255
- })
541
+
542
+ .then(function (account) {
543
+
544
+ console.log('The Seeuletter API Account responded : ', account)
545
+
546
+ })
547
+
548
+ .catch(function (err) {
549
+
550
+ console.log('Error message : ', err.message)
551
+
552
+ })
553
+
554
+
256
555
 
257
556
  ```
258
557
 
558
+
559
+
259
560
  #### Update the account company email
260
561
 
562
+
563
+
261
564
  ```javascript
262
- var Seeuletter = require('seeuletter')('YOUR API KEY');
565
+
566
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
567
+
568
+
263
569
 
264
570
  // Update the account
571
+
265
572
  Seeuletter.accounts.updateEmail("ACCOUNT COMPANY ID", "UPDATED EMAIL")
266
- .then(function () {
267
- console.log('The Seeuletter API Account responded with success')
268
- })
269
- .catch(function (err) {
270
- console.log('Error message : ', err.message)
271
- })
573
+
574
+ .then(function () {
575
+
576
+ console.log('The Seeuletter API Account responded with success')
577
+
578
+ })
579
+
580
+ .catch(function (err) {
581
+
582
+ console.log('Error message : ', err.message)
583
+
584
+ })
585
+
586
+
272
587
 
273
588
  ```
274
589
 
590
+
591
+
275
592
  ### Invoices
276
593
 
594
+
595
+
277
596
  #### List all invoices for a company
278
597
 
598
+
599
+
279
600
  ```javascript
280
- var Seeuletter = require('seeuletter')('YOUR API KEY');
601
+
602
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
603
+
604
+
281
605
 
282
606
  // Getting the invoice list
607
+
283
608
  Seeuletter.invoices.list({
284
- // Pass optional filter here as object
609
+
610
+ // Pass optional filter here as object
611
+
285
612
  })
286
- .then(function (response) {
287
- console.log('The Seeuletter API Invoices responded : ', response)
288
- })
289
- .catch(function (err) {
290
- console.log('Error message : ', err.message)
291
- })
613
+
614
+ .then(function (response) {
615
+
616
+ console.log('The Seeuletter API Invoices responded : ', response)
617
+
618
+ })
619
+
620
+ .catch(function (err) {
621
+
622
+ console.log('Error message : ', err.message)
623
+
624
+ })
625
+
626
+
292
627
 
293
628
  ```
294
629
 
630
+
631
+
295
632
  #### Retrieve a specific invoice
296
633
 
634
+
635
+
297
636
  ```javascript
298
- var Seeuletter = require('seeuletter')('YOUR API KEY');
637
+
638
+ var Seeuletter = require('seeuletter')('YOUR API KEY');
639
+
640
+
299
641
 
300
642
  // Getting the invoice list
643
+
301
644
  Seeuletter.invoices.retrieve("INVOICE ID")
302
- .then(function (invoice) {
303
- console.log('The Seeuletter API Invoice responded : ', invoice)
304
- })
305
- .catch(function (err) {
306
- console.log('Error message : ', err.message)
307
- })
645
+
646
+ .then(function (invoice) {
647
+
648
+ console.log('The Seeuletter API Invoice responded : ', invoice)
649
+
650
+ })
651
+
652
+ .catch(function (err) {
653
+
654
+ console.log('Error message : ', err.message)
655
+
656
+ })
657
+
658
+
308
659
 
309
660
  ```
310
661
 
662
+
663
+
311
664
  =======================
312
665
 
666
+
667
+
313
668
  Copyright &copy; 2025 Exaland.app
314
669
 
315
- Released under the MIT License, which can be found in the repository in `LICENSE.txt`.
670
+
671
+
672
+ Released under the MIT License, which can be found in the repository in `LICENSE.txt`.
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "Mysendingbox.com",
12
12
  "printing"
13
13
  ],
14
- "version": "1.0.5",
14
+ "version": "1.0.6",
15
15
  "homepage": "https://github.com/exaland/mysendingbox-node",
16
16
  "author": "Exaland Concept For -> Mysendingbox <hello@mysendingbox.fr> (https://www.mysendingbox.fr/)",
17
17
  "dependencies": {