whatsapp_sdk 1.0.3 → 1.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68fa7bcce031d800ba3b8c541992921e602fd9266172fda8c2b9db9a0d400efc
4
- data.tar.gz: e7922f22f38e79a5e2cca6377c86d0bc5a1a2a26beb859b2311b21f6a9be33e7
3
+ metadata.gz: c79999d78bf13c93ea72eed223f7206e73578e8e5b55e414697f6245d5f99896
4
+ data.tar.gz: e0616cb9cc093b931832bdf0e1b0207a2f349a31b7d7e4ad10225d3255638547
5
5
  SHA512:
6
- metadata.gz: f4ae0d0f4f0fff5d85d22255ed36eb063f7b4a3eac744f4d31dca4fc5c86605116bf34043932e17a4b10e8dba9433cf1a7c2aaca54a0becd5bf13ae8ce00a167
7
- data.tar.gz: d0a8e8ef860b48363804833bb518dafc5eb417e09f53d1ffd5cfd797368d9611d040fcdbec55977d886bea265924916c35c65e54c07ba1a41773cb1c2060fa9d
6
+ metadata.gz: e19b232af56af50e3ed013240af0db6bce6774d8c0fa56ba0d5792d773aa637de67e42077ed994d85c5011bd59fdac970ae6ec68e9c9cdbf82b8815301f9ce59
7
+ data.tar.gz: 57f65a303fd92a6bd4262a89bc428994b4789563bf8eb9e1abb39e3a9743d06aa4f5a9d7823ad0fdc108e80ea297717c3515bc5338d5eaeb57b214524ba344ee
data/.rubocop.yml CHANGED
@@ -8,7 +8,6 @@ AllCops:
8
8
  - 'example.rb'
9
9
  - 'tmp/*'
10
10
  - 'vendor/**/*'
11
- TargetRubyVersion: 3.1
12
11
 
13
12
  Style/HashSyntax:
14
13
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Unreleased
2
2
 
3
+ # v 1.0.4
4
+ - Support for version 23 and 24 API. [180](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/180)
5
+
3
6
  # v 1.0.3
4
7
  - Fix configuration bug setting `api_version` on Configure. @frenesim [#168](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/168)
5
8
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whatsapp_sdk (1.0.3)
4
+ whatsapp_sdk (1.0.4)
5
5
  faraday (~> 2.0, > 2.0.1)
6
6
  faraday-multipart (~> 1)
7
7
  zeitwerk (~> 2)
@@ -16,23 +16,23 @@ GEM
16
16
  coderay (1.1.3)
17
17
  crack (0.4.5)
18
18
  rexml
19
- faraday (2.12.0)
20
- faraday-net_http (>= 2.0, < 3.4)
19
+ faraday (2.14.0)
20
+ faraday-net_http (>= 2.0, < 3.5)
21
21
  json
22
22
  logger
23
- faraday-multipart (1.0.4)
24
- multipart-post (~> 2)
25
- faraday-net_http (3.3.0)
26
- net-http
23
+ faraday-multipart (1.2.0)
24
+ multipart-post (~> 2.0)
25
+ faraday-net_http (3.4.2)
26
+ net-http (~> 0.5)
27
27
  hashdiff (1.0.1)
28
- json (2.7.2)
29
- logger (1.6.1)
28
+ json (2.18.0)
29
+ logger (1.7.0)
30
30
  method_source (1.0.0)
31
31
  minitest (5.16.1)
32
32
  mocha (1.14.0)
33
33
  multipart-post (2.4.1)
34
- net-http (0.4.1)
35
- uri
34
+ net-http (0.9.1)
35
+ uri (>= 0.11.1)
36
36
  parallel (1.22.1)
37
37
  parser (3.1.2.0)
38
38
  ast (~> 2.4.1)
@@ -45,7 +45,7 @@ GEM
45
45
  rainbow (3.1.1)
46
46
  rake (12.3.3)
47
47
  regexp_parser (2.5.0)
48
- rexml (3.3.9)
48
+ rexml (3.4.2)
49
49
  rubocop (1.30.1)
50
50
  parallel (~> 1.10)
51
51
  parser (>= 3.1.0.0)
@@ -64,18 +64,20 @@ GEM
64
64
  rubocop-ast (>= 0.4.0)
65
65
  ruby-progressbar (1.11.0)
66
66
  unicode-display_width (2.2.0)
67
- uri (0.13.1)
67
+ uri (1.1.1)
68
68
  vcr (6.3.1)
69
69
  base64
70
70
  webmock (3.18.1)
71
71
  addressable (>= 2.8.0)
72
72
  crack (>= 0.3.2)
73
73
  hashdiff (>= 0.4.0, < 2.0.0)
74
- zeitwerk (2.6.18)
74
+ zeitwerk (2.7.4)
75
75
 
76
76
  PLATFORMS
77
77
  arm64-darwin-21
78
78
  arm64-darwin-22
79
+ arm64-darwin-23
80
+ arm64-darwin-24
79
81
  x86_64-darwin-19
80
82
  x86_64-darwin-21
81
83
  x86_64-linux
data/README.md CHANGED
@@ -7,6 +7,39 @@
7
7
  The SDK provides a set of operations and classes to use the Whatsapp API.
8
8
  Send stickers, messages, audio, videos, locations, react and reply to messages or just ask for the phone numbers through this library in a few steps!
9
9
 
10
+ ## Table of Contents
11
+
12
+ - [Features](#features)
13
+ - [Installation](#installation)
14
+ - [Quick Start](#quick-start)
15
+ - [Set up a Meta app](#set-up-a-meta-app)
16
+ - [Usage Overview](#usage-overview)
17
+ - [APIs](#apis)
18
+ - [Templates](#templates)
19
+ - [Business Profile API](#business-profile-api)
20
+ - [Phone numbers API](#phone-numbers-api)
21
+ - [Media API](#media-api)
22
+ - [Messages API](#messages-api)
23
+ - [Errors](#errors)
24
+ - [Examples](#examples)
25
+ - [Whatsapp Cloud API](#whatsapp-cloud-api)
26
+ - [Troubleshooting](#troubleshooting)
27
+ - [Development](#development)
28
+ - [Contributing](#contributing)
29
+ - [Changelog](#changelog)
30
+ - [License](#license)
31
+
32
+ ## Features
33
+
34
+ - **Send Messages**: Text, images, audio, video, documents, stickers, locations, and contacts.
35
+ - **React & Reply**: React to messages with emojis and reply to specific messages.
36
+ - **Message Templates**: Send pre-approved message templates for notifications.
37
+ - **Interactive Messages**: List messages and reply buttons.
38
+ - **Media Management**: Upload, download, and delete media files.
39
+ - **Phone Numbers**: Register, deregister, and query phone numbers.
40
+ - **Business Profile**: Get and update business profile details.
41
+ - **Templates Management**: Create, list, and delete message templates.
42
+
10
43
  ## Demo
11
44
 
12
45
  https://user-images.githubusercontent.com/11672878/173238826-6fc0a6f8-d0ee-4eae-8947-7dfd3b8b3446.mov
@@ -56,11 +89,10 @@ Available API version can be found [here](https://developers.facebook.com/docs/g
56
89
  #### Option 2) Create a `Client` instance :
57
90
 
58
91
  ```ruby
59
-
60
- # without
92
+ # Basic usage
61
93
  client = WhatsappSdk::Api::Client.new("<ACCESS TOKEN>") # replace this with a valid access token
62
94
 
63
- # OR optionally use a logger, api_version and
95
+ # With optional logger and API version
64
96
  logger = Logger.new(STDOUT)
65
97
  logger_options = { bodies: true }
66
98
  client = WhatsappSdk::Api::Client.new("<ACCESS TOKEN>", "<API VERSION>", logger, logger_options)
@@ -86,8 +118,6 @@ Try sending a message to your phone in the UI.
86
118
  <img width="1010" alt="Screen Shot 2022-09-05 at 11 13 24 AM" src="https://user-images.githubusercontent.com/11672878/188480634-369f8de1-b851-4735-86de-f49e96f78d8c.png">
87
119
  </details>
88
120
 
89
- </details>
90
-
91
121
  <details><summary>5) Use the GEM to interact with Whatsapp</summary>
92
122
 
93
123
  Example:
@@ -131,20 +161,20 @@ Check the [example.rb file](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk
131
161
 
132
162
  </details>
133
163
 
134
- ## Sneak Peek
164
+ ## Usage Overview
135
165
 
136
166
  ```ruby
137
167
  client = WhatsappSdk::Api::Client.new("<ACCESS TOKEN>") # replace this with a valid access token
138
168
 
139
- client.phone_numbers.register_number(SENDER_ID, 123456) # register the phone number to uplaod media and send message from.
169
+ client.phone_numbers.register_number(SENDER_ID, 123456) # register the phone number to upload media and send messages from.
140
170
 
141
171
  # send a text and a location
142
- client.messages.send_text(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER,message: "Hey there! it's Whatsapp Ruby SDK")
172
+ client.messages.send_text(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, message: "Hey there! it's Whatsapp Ruby SDK")
143
173
 
144
174
  client.messages.send_location(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, longitude: -75.6898604, latitude: 45.4192206, name: "Ignacio", address: "My house")
145
175
 
146
176
  # upload a photo and send it
147
- image = client.media.upload(sender_id: SENDER_ID, file_path: "test/fixtures/assets/whatsapp.png", type: "image/png")image = client.media.get(media_id: uploaded_media.id)
177
+ image = client.media.upload(sender_id: SENDER_ID, file_path: "test/fixtures/assets/whatsapp.png", type: "image/png")
148
178
  client.messages.send_image(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, image_id: image.id)
149
179
 
150
180
  # upload a sticker and send it
@@ -183,7 +213,7 @@ client.templates.delete(business_id: BUSINESS_ID, name: "my_name") # delete by n
183
213
 
184
214
  ```ruby
185
215
  # Get the details of your business
186
- client.business_profiles.get(phone_number_id)
216
+ client.business_profiles.get(SENDER_ID)
187
217
 
188
218
  # Update the details of your business
189
219
  client.business_profiles.update(phone_number_id: SENDER_ID, params: { about: "A very cool business" } )
@@ -196,16 +226,16 @@ client.business_profiles.update(phone_number_id: SENDER_ID, params: { about: "A
196
226
 
197
227
  ```ruby
198
228
  # Get the list of phone numbers registered
199
- client.phone_numbers.list(business_id)
229
+ client.phone_numbers.list(BUSINESS_ID)
200
230
 
201
- # Get the a phone number by id
202
- client.phone_numbers.get(phone_number_id)
231
+ # Get a phone number by id
232
+ client.phone_numbers.get(SENDER_ID)
203
233
 
204
234
  # Register a phone number
205
- client.phone_numbers.register_number(phone_number_id, pin)
235
+ client.phone_numbers.register_number(SENDER_ID, pin)
206
236
 
207
237
  # Deregister a phone number
208
- client.phone_numbers.deregister_number(phone_number_id)
238
+ client.phone_numbers.deregister_number(SENDER_ID)
209
239
  ```
210
240
 
211
241
  </details>
@@ -235,68 +265,68 @@ client.media.delete(media_id: MEDIA_ID)
235
265
 
236
266
  ```ruby
237
267
  # Send a text message
238
- client.messages.send_text(sender_id: 1234, recipient_number: 112345678, message: "hola")
268
+ client.messages.send_text(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, message: "hola")
239
269
 
240
270
  # Read a message
241
- client.messages.read_message(sender_id: 1234, message_id: "wamid.HBgLMTM0M12345678910=")
271
+ client.messages.read_message(sender_id: SENDER_ID, message_id: "wamid.HBgLMTM0M12345678910=")
242
272
 
243
273
  # Note: To get the `message_id` you can set up [Webhooks](https://developers.facebook.com/docs/whatsapp/cloud-api/webhooks/components) that will listen and fire an event when a message is received.
244
274
 
245
275
  # Send a reaction to message
246
276
  # To send a reaction to a message, you need to obtain the message id and look for the emoji's unicode you want to use.
247
- client.messages.send_reaction(sender_id: 123_123, recipient_number: 56_789, message_id: "12345", emoji: "\u{1f550}")
248
- client.messages.send_reaction(sender_id: 123_123, recipient_number: 56_789, message_id: "12345", emoji: "⛄️")
277
+ client.messages.send_reaction(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, message_id: "12345", emoji: "\u{1f550}")
278
+ client.messages.send_reaction(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, message_id: "12345", emoji: "⛄️")
249
279
 
250
280
  # Reply to a message
251
281
  # To reply to a message, just include the id of the message in the `client.messages` methods. For example, to reply to a text message include the following:
252
- client.messages.send_text(sender_id: 123_123, recipient_number: 56_789, message: "I'm a reply", message_id: "wamid.1234")
282
+ client.messages.send_text(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, message: "I'm a reply", message_id: "wamid.1234")
253
283
 
254
284
  # Send a location message
255
285
  client.messages.send_location(
256
- sender_id: 123123, recipient_number: 56789,
286
+ sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER,
257
287
  longitude: 45.4215, latitude: 75.6972, name: "nacho", address: "141 cooper street"
258
288
  )
259
289
 
260
290
  # Send an image message
261
291
  # It uses a link or an image_id.
262
292
  # with a link
263
- client.messages.send_image(sender_id: 123123, recipient_number: 56789, link: "image_link", caption: "Ignacio Chiazzo Profile")
293
+ client.messages.send_image(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: "image_link", caption: "Ignacio Chiazzo Profile")
264
294
 
265
295
  # with an image id
266
- client.messages.send_image(sender_id: 123123, recipient_number: 56789, image_id: "1234", caption: "Ignacio Chiazzo Profile")
296
+ client.messages.send_image(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, image_id: "1234", caption: "Ignacio Chiazzo Profile")
267
297
 
268
298
 
269
299
  # Send an audio message
270
300
  # It uses a link or an audio_id.
271
301
  # with a link
272
- client.messages.send_audio(sender_id: 123123, recipient_number: 56789, link: "audio_link")
302
+ client.messages.send_audio(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: "audio_link")
273
303
 
274
304
  # with an audio id
275
- client.messages.send_audio(sender_id: 123123, recipient_number: 56789, audio_id: "1234")
305
+ client.messages.send_audio(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, audio_id: "1234")
276
306
 
277
307
  # Send a document message
278
308
  # It uses a link or a document_id.
279
309
  # with a link
280
- client.messages.send_document(sender_id: 123123, recipient_number: 56789, link: "document_link", caption: "Ignacio Chiazzo")
310
+ client.messages.send_document(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: "document_link", caption: "Ignacio Chiazzo")
281
311
 
282
312
  # with a document id
283
- client.messages.send_document(sender_id: 123123, recipient_number: 56789, document_id: "1234", caption: "Ignacio Chiazzo")
284
- # Note, you can specify the filename via argument [`filename`](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages).
313
+ client.messages.send_document(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, document_id: "1234", caption: "Ignacio Chiazzo")
314
+ # Note, you can specify the filename via argument [`filename`](https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages).
285
315
 
286
316
  # Send a sticker message
287
317
  # It could use a link or a sticker_id.
288
318
  # with a link
289
- client.messages.send_sticker(sender_id: 123123, recipient_number: 56789, link: "link")
319
+ client.messages.send_sticker(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: "link")
290
320
 
291
321
  # with a sticker_id
292
- client.messages.send_sticker(sender_id: 123123, recipient_number: 56789, sticker_id: "1234")
322
+ client.messages.send_sticker(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, sticker_id: "1234")
293
323
 
294
324
  # Send contacts message
295
325
  # To send a contact, you need to create a Contact instance object that contain objects embedded like `addresses`, `birthday`, `emails`, `name`, `org`. See this [guide](/test/contact_helper.rb) to learn how to create contacts objects.
296
- client.messages.send_contacts(sender_id: 123123, recipient_number: 56789, contacts: [create_contact(params)])
326
+ client.messages.send_contacts(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, contacts: [create_contact(params)])
297
327
 
298
328
  # Alternatively, you could pass a plain json like this:
299
- client.messages.send_contacts(sender_id: 123123, recipient_number: 56789, contacts_json: {...})
329
+ client.messages.send_contacts(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, contacts_json: {...})
300
330
 
301
331
  # Send a template message
302
332
  # WhatsApp message templates are specific message formats that businesses use to send out notifications or customer care messages to people that have opted in to notifications. Messages can include appointment reminders, shipping information, issue resolution or payment updates.
@@ -323,7 +353,7 @@ parameter_location = WhatsappSdk::Resource::ParameterObject.new(type: "location"
323
353
  header_component = WhatsappSdk::Resource::Component.new(type: "header", parameters: [parameter_image])
324
354
 
325
355
  body_component = WhatsappSdk::Resource::Component.new(
326
- type: "body",
356
+ type: "body",
327
357
  parameters: [parameter_text, parameter_currency, parameter_date_time]
328
358
  )
329
359
 
@@ -347,7 +377,7 @@ button_component2 = WhatsappSdk::Resource::Component.new(
347
377
 
348
378
  location_component = WhatsappSdk::Resource::Component.new(type: "header", parameters: [parameter_location])
349
379
  client.messages.send_template(
350
- sender_id: 12_345, recipient_number: 12345678, name: "hello_world", language: "en_US", components: [...]
380
+ sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, name: "hello_world", language: "en_US", components: [...]
351
381
  )
352
382
  ```
353
383
 
@@ -356,7 +386,7 @@ client.messages.send_template(
356
386
  Alternatively, you could pass a plain json like this:
357
387
 
358
388
  ```ruby
359
- client.messages.send_template(sender_id: 12_345, recipient_number: 12345678, name: "hello_world", language: "en_US", components_json: [{...}])
389
+ client.messages.send_template(sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, name: "hello_world", language: "en_US", components_json: [{...}])
360
390
  ```
361
391
 
362
392
  **Send interactive messages**
@@ -402,7 +432,7 @@ Alternatively, you could pass a plain json like this:
402
432
 
403
433
  ```ruby
404
434
  client.messages.send_interactive_list_messages(
405
- sender_id: 12_345, recipient_number: 1234567890
435
+ sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER
406
436
  interactive_json: {...}
407
437
  )
408
438
  ```
@@ -437,27 +467,27 @@ interactive_reply_buttons = WhatsappSdk::Resource::Interactive.new(
437
467
  )
438
468
 
439
469
  client.messages.send_interactive_reply_buttons(
440
- sender_id: 12_345, recipient_number: 1234567890,
470
+ sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER,
441
471
  interactive: interactive_reply_buttons
442
472
  )
443
473
  ```
444
474
 
445
475
  </details>
446
476
 
447
- Alternative, you could pass a plain json like this:
477
+ Alternatively, you could pass a plain json like this:
448
478
 
449
479
  ```ruby
450
480
  client.messages.send_interactive_reply_buttons(
451
- sender_id: 12_345, recipient_number: 1234567890
481
+ sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER
452
482
  interactive_json: {...}
453
483
  )
454
484
  ```
455
485
 
456
486
  </details>
457
487
 
458
- ### Errors
488
+ ## Errors
459
489
 
460
- If the API returns an error then an exception `WhatsappSdk::Api::Responses::HttpResponseError` is raised. The object contains information returned by the Cloud API. For more information about the potential error check the [official documentation](https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes/).
490
+ If the API returns an error then an exception `WhatsappSdk::Api::Responses::HttpResponseError` is raised. The object contains information returned by the Cloud API. For more information about the potential error check the [official documentation](https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes/).
461
491
 
462
492
  ## Examples
463
493
 
@@ -473,7 +503,7 @@ Visit [the example file](/example.rb) with examples to call the API in a single
473
503
  If you try to send a text message directly without a message template created and approved in your Meta control panel, you can't start a chat with other people. But if you receive a message before, it's possible to send a message.
474
504
 
475
505
  If the API response is still `success`, but the message is not delivered:
476
- - ensure the device you're sending the message to is using a supported Whatsapp version. [Check documentation](https://developers.facebook.com/docs/whatsapp/cloud-api/support/troubleshooting#message-not-delivered). Try also replying a message to the number you are registered on your Whatsapp.
506
+ - Ensure the device you're sending the message to is using a supported Whatsapp version. [Check documentation](https://developers.facebook.com/docs/whatsapp/cloud-api/support/troubleshooting#message-not-delivered). Try also replying a message to the number you are registered on your Whatsapp.
477
507
  - Ensure your Meta App uses an API version greater than or equal to `v.14`.
478
508
  - Ensure that the Panel in the Facebook dashboard doesn't display any errors.
479
509
 
@@ -483,15 +513,14 @@ Note: Sometimes the messages are delayed; see [Meta documentation](https://devel
483
513
 
484
514
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
485
515
 
486
- Run ' bundle exec rake install' to install this gem onto your local machine. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
516
+ Run `bundle exec rake install` to install this gem onto your local machine. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
487
517
 
488
518
  ### Run all the tests
489
519
 
490
520
  - **Unit tests:** Run `rake test`
491
- - **Sorbet Typecheck:** run `srb tc`
492
521
  - **Linters:** `bundle exec rubocop`
493
522
 
494
- To update the Cloud API version update the version in `lib/whatsapp_sdk/api/api_configuration.rb`. Check the [Cloud API changelog for API udpates](https://developers.facebook.com/docs/whatsapp/business-platform/changelog#api-error-response-behavior).
523
+ To update the Cloud API version update the version in `lib/whatsapp_sdk/api/api_configuration.rb`. Check the [Cloud API changelog for API updates](https://developers.facebook.com/docs/whatsapp/business-platform/changelog#api-error-response-behavior).
495
524
 
496
525
  ## Contributing
497
526
 
@@ -503,6 +532,10 @@ Do you want to contribute and are unsure where to start? Ping me on Twitter, and
503
532
 
504
533
  Check [Contributing](/CONTRIBUTING.MD) file.
505
534
 
535
+ ## Changelog
536
+
537
+ See [CHANGELOG.md](CHANGELOG.md) for a list of changes.
538
+
506
539
  ## License
507
540
 
508
541
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -7,9 +7,9 @@ module WhatsappSdk
7
7
  module Api
8
8
  class Client
9
9
  API_VERSIONS = [
10
- 'v21.0', 'v20.0', 'v19.0', 'v18.0', 'v17.0', 'v16.0', 'v15.0', 'v14.0', 'v13.0', 'v12.0',
11
- 'v11.0', 'v10.0', 'v9.0', 'v8.0', 'v7.0', 'v6.0', 'v5.0', 'v4.0', 'v3.3',
12
- 'v3.2', 'v3.1', 'v3.0', 'v2.12', 'v2.11', 'v2.10', 'v2.9', 'v2.8', 'v2.7',
10
+ 'v24.0', 'v23.0', 'v22.0', 'v21.0', 'v20.0', 'v19.0', 'v18.0', 'v17.0', 'v16.0', 'v15.0', 'v14.0',
11
+ 'v13.0', 'v12.0', 'v11.0', 'v10.0', 'v9.0', 'v8.0', 'v7.0', 'v6.0', 'v5.0', 'v4.0',
12
+ 'v3.3', 'v3.2', 'v3.1', 'v3.0', 'v2.12', 'v2.11', 'v2.10', 'v2.9', 'v2.8', 'v2.7',
13
13
  'v2.6', 'v2.5', 'v2.4', 'v2.3', 'v2.2', 'v2.1'
14
14
  ].freeze
15
15
 
@@ -50,7 +50,7 @@ module WhatsappSdk
50
50
  def send_request(endpoint: "", full_url: nil, http_method: "post", params: {}, headers: {}, multipart: false)
51
51
  url = full_url || "#{ApiConfiguration::API_URL}/#{@api_version}/"
52
52
 
53
- faraday_request = faraday(url:, multipart:)
53
+ faraday_request = faraday(url: url, multipart: multipart)
54
54
 
55
55
  response = faraday_request.public_send(http_method, endpoint, request_params(params, headers), headers)
56
56
 
@@ -411,6 +411,31 @@ module WhatsappSdk
411
411
  Api::Responses::MessageDataResponse.build_from_response(response: response)
412
412
  end
413
413
 
414
+ # Send typing indicator
415
+ #
416
+ # @param sender_id [Integer] Sender' phone number.
417
+ # @param message_id [String] the id of the message received in the messages webhooks.
418
+ # @return [Hash] Response object with success status.
419
+ def send_typing_indicator(sender_id:, message_id:)
420
+ params = {
421
+ messaging_product: "whatsapp",
422
+ recipient_type: "individual",
423
+ status: "read",
424
+ message_id: message_id,
425
+ typing_indicator: {
426
+ type: "text"
427
+ }
428
+ }
429
+
430
+ response = send_request(
431
+ endpoint: endpoint(sender_id),
432
+ params: params,
433
+ headers: DEFAULT_HEADERS
434
+ )
435
+
436
+ Api::Responses::SuccessResponse.success_response?(response: response)
437
+ end
438
+
414
439
  private
415
440
 
416
441
  def endpoint(sender_id)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WhatsappSdk
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whatsapp_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ignacio-chiazzo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-08 00:00:00.000000000 Z
11
+ date: 2025-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
210
  requirements: []
211
- rubygems_version: 3.3.3
211
+ rubygems_version: 3.4.1
212
212
  signing_key:
213
213
  specification_version: 4
214
214
  summary: Use the Ruby Whatsapp SDK to communicate with Whatsapp API using the Cloud