whatsapp_sdk 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 70e66d8860068d5cab7de45cf1972de69e5ddbb24e8195fbfa6643eef55a6da8
4
- data.tar.gz: 5894ded02a7d2ed5440801f5431146451d83753a630eb4c795e25c141f207885
3
+ metadata.gz: e174b898e076d20337b2566c9467a0fc6ab2e8aa5d3f4185dd8bcec6a754d25f
4
+ data.tar.gz: 2fbb40187adeb8006b345c6b37de12c575cd9f6d1625f5e1befff2caaa3c0568
5
5
  SHA512:
6
- metadata.gz: d3c9b6522b7d8ef331a635bddaa0cb5aa2f4821bb1a755e0395a6af844fdd5da3602f8b8fde04601f0c4389f80661d4ec4d42b46693b1f3baa55e4cc9e56ee1e
7
- data.tar.gz: 4951df21c4943bba0992c698fed0f8870604889cf2b3145ac069a6daf61bf7910b3761fe736f2a2bbf0fbf867e5c6c9ba22f04456041e20ee3d7b38b8d8966ed
6
+ metadata.gz: cd4aa67163bb7ebcab95865b583d779d209453b383df131d46ac7baddf6002f37276c627a332f4ac3f792549a2f4d4d9bed27486e9500042b850c17e4ba03dcd
7
+ data.tar.gz: 1ed23faa24804aebf48733a24c8d42ada544f5895ff5323fc0cac172c0bf4becf51abf3e75eadb85f3d5ead98beb3c1cd0d18fc329e10fdc1ce0b4139a07c3c2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # v 0.6.0
2
+ Fix issue on Linux when files are not sorted [#45](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/45)
3
+
4
+ # v 0.5.1
5
+ Remove warnings [#41](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/41)
6
+
7
+ # v 0.5.0
8
+ Require Faraday [#40](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/40)
9
+
1
10
  # v 0.4.0
2
11
  - Make the gem stricly typed using Sorbet [#34](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/34), [#35](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/35), [#37](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/37)
3
12
  - Object IDs are Strings in development [#37](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk/pull/37)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- whatsapp_sdk (0.5.0)
4
+ whatsapp_sdk (0.6.0)
5
5
  faraday (~> 2.3.0)
6
6
  faraday-multipart (~> 1.0.4)
7
7
  oj (~> 3.13.13)
data/README.md CHANGED
@@ -48,17 +48,6 @@ messages_api = WhatsappSdk::Api::Messages.new(client)
48
48
 
49
49
  Each API operation returns a `WhatsappSdk::Api::Response` that contains `data` and `error` and a couple of helpful functions such as `ok?` and `error?`. There are three types of response `WhatsappSdk::Api::MessageDataResponse`, `WhatsappSdk::Api::PhoneNumberDataResponse` and `WhatsappSdk::Api::PhoneNumbersDataResponse`. Each of them contains different attributes.
50
50
 
51
- ## Operations
52
- First, create the client and then create an instance `WhatsappSdk::Api::Messages` that requires a client as a param like this:
53
-
54
- ```ruby
55
- messages_api = WhatsappSdk::Api::Messages.new
56
- phone_numbers_api = WhatsappSdk::Api::PhoneNumbers.new
57
- medias_api = WhatsappSdk::Api::Medias.new
58
- ```
59
-
60
- Note: Remember to initialize the client first!
61
-
62
51
  ## Set up a Meta app
63
52
 
64
53
  <details><summary>1) Create a Meta Business app </summary>
@@ -123,10 +112,23 @@ Check the [example.rb file](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk
123
112
 
124
113
  </details>
125
114
 
115
+ ## Operations
116
+ First, create the client and then create an instance `WhatsappSdk::Api::Messages` that requires a client as a param like this:
126
117
 
118
+ ```ruby
119
+ messages_api = WhatsappSdk::Api::Messages.new
120
+ phone_numbers_api = WhatsappSdk::Api::PhoneNumbers.new
121
+ medias_api = WhatsappSdk::Api::Medias.new
122
+ ```
127
123
 
124
+ Note: Remember to initialize the client first!
125
+
126
+ ## APIs
128
127
 
129
128
  ### Phone numbers API
129
+
130
+ <details>
131
+
130
132
  Get the list of phone numbers registered
131
133
  ```ruby
132
134
  phone_numbers_api.registered_numbers(123456) # accepts a business_id
@@ -136,8 +138,10 @@ Get the a phone number by id
136
138
  ```ruby
137
139
  phone_numbers_api.registered_numbers(123456) # accepts a phone_number_id
138
140
  ```
141
+ </details>
139
142
 
140
143
  ### Media API
144
+ <details>
141
145
 
142
146
  Upload a media
143
147
  ```ruby
@@ -159,7 +163,10 @@ Delete a media
159
163
  medias_api.delete(media_id: MEDIA_ID)
160
164
  ```
161
165
 
166
+ </details>
167
+
162
168
  ### Messages API
169
+ <details>
163
170
 
164
171
  **Send a text message**
165
172
 
@@ -300,12 +307,12 @@ Alernative, you could pass a plain json like this:
300
307
  ```ruby
301
308
  @messages_api.send_template(sender_id: 12_345, recipient_number: 12345678, name: "hello_world", language: "en_US", components_json: [{...}])
302
309
  ```
310
+ </details>
303
311
 
304
- ## Example
312
+ ## Examples
305
313
 
306
314
  Visit [the example file](/example.rb) with examples to call the API in a single file.
307
315
 
308
-
309
316
  ## Whatsapp Cloud API
310
317
 
311
318
  - See the [official documentation](https://developers.facebook.com/docs/whatsapp/cloud-api) for the Whatsapp Cloud API.
@@ -313,7 +320,11 @@ Visit [the example file](/example.rb) with examples to call the API in a single
313
320
 
314
321
  ## Troubleshooting
315
322
 
316
- - If the API response is `success` but the message is not delivered, make sure 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)
323
+ - If the API response is `success`, but the message is not delivered, 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 your registered on your Whatsapp.
324
+ - Ensure your Meta App uses an API version greater than or equal to `v.14`.
325
+ - Ensure that the Panel in the Facebook dashboard doesn't display any error.
326
+
327
+ Note: Sometimes the messages are delayed, see [Meta documentation](https://developers.facebook.com/docs/whatsapp/on-premises/guides/send-message-performance#delays).
317
328
 
318
329
  ## Development
319
330
 
@@ -321,15 +332,17 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
321
332
 
322
333
  To install this gem onto your local machine, run `bundle exec rake install`. 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).
323
334
 
324
- ## Contributing
325
-
326
- Bug reports and pull requests are welcome on GitHub at [https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk) This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
327
-
328
335
  ### Run all the tests
329
336
  - **Unit tests:** Run `rake test`
330
337
  - **Sorbet Typecheck:** run `srb tc`
331
338
  - **Linters:** `bundle exec rubocop`
332
339
 
340
+ ## Contributing
341
+
342
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk](https://github.com/ignacio-chiazzo/ruby_whatsapp_sdk) This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
343
+
344
+ If you want a feature to be implemented in the gem, please, open an issue and we will take a look as soon as we can.
345
+
333
346
  ## License
334
347
 
335
348
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/example.rb CHANGED
@@ -11,7 +11,7 @@ gemfile(true) do
11
11
 
12
12
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
13
13
 
14
- gem "whatsapp_sdk", path: "/Users/ignaciochiazzo/src/whatsapp_sdk"
14
+ gem "whatsapp_sdk"
15
15
  gem "pry"
16
16
  gem "pry-nav"
17
17
  end
@@ -21,12 +21,12 @@ require "pry"
21
21
  require "pry-nav"
22
22
 
23
23
  ################# UPDATE CONSTANTS #################
24
- ACCESS_TOKEN = "EAAVRvYO3LQMBANyzA38RmXZA83VGGwYblwZASqrEU50dZBki0vqEsGSlglL2nuyD9XVbX0qxbSQURnzW5jkwvfrz8J0P3XW3CSM1R03n81ZBjd1dLHsYIIPdhF8NjMy8hnwYDzTFLSabpkWlD7LQ7VWQAx5k64XgNv02DFLt2EhgVhib09SmEj6ZBSKZBknasHjaTUcgX0iQZDZD" # replace this with a valid access_token # TODO replace
25
- BUSINESS_ID = 101292429380714
26
- SENDER_ID = 108129082031154
27
- RECIPIENT_NUMBER = 5511970395230
28
24
 
29
- IMAGE_LINK = "https://ignaciochiazzo.com/static/4c403819b9750c8ad8b20a75308f2a8a/876d5/profile-pic.avif"
25
+ ACCESS_TOKEN = "<TODO replace>"
26
+ SENDER_ID = "<TODO replace>"
27
+ RECIPIENT_NUMBER = "<TODO replace>"
28
+ BUSINESS_ID = "<TODO replace>"
29
+ IMAGE_LINK = "<TODO replace>"
30
30
 
31
31
  ################# Initialize Client #################
32
32
  WhatsappSdk.configure do |config|
@@ -46,7 +46,6 @@ end
46
46
  medias_api = WhatsappSdk::Api::Medias.new
47
47
  messages_api = WhatsappSdk::Api::Messages.new
48
48
  phone_numbers_api = WhatsappSdk::Api::PhoneNumbers.new
49
- binding.pry
50
49
 
51
50
  ############################## Phone Numbers API ##############################
52
51
  registered_number = phone_numbers_api.registered_number(SENDER_ID)
@@ -2,5 +2,5 @@
2
2
  # typed: strict
3
3
 
4
4
  module WhatsappSdk
5
- VERSION = "0.5.0"
5
+ VERSION = "0.6.0"
6
6
  end
data/whatsapp_sdk.gemspec CHANGED
@@ -1,9 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  # typed: true
3
3
 
4
+ require_relative 'lib/whatsapp_sdk/version'
5
+
4
6
  lib = File.expand_path('lib', __dir__)
5
7
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
6
- require "version"
7
8
 
8
9
  Gem::Specification.new do |spec|
9
10
  spec.name = "whatsapp_sdk"
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: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ignacio-chiazzo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-14 00:00:00.000000000 Z
11
+ date: 2022-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -165,7 +165,6 @@ files:
165
165
  - bin/setup
166
166
  - bin/tapioca
167
167
  - example.rb
168
- - lib/version.rb
169
168
  - lib/whatsapp_sdk.rb
170
169
  - lib/whatsapp_sdk/api/client.rb
171
170
  - lib/whatsapp_sdk/api/medias.rb
@@ -200,6 +199,7 @@ files:
200
199
  - lib/whatsapp_sdk/resource/parameter_object.rb
201
200
  - lib/whatsapp_sdk/resource/phone_number.rb
202
201
  - lib/whatsapp_sdk/resource/url.rb
202
+ - lib/whatsapp_sdk/version.rb
203
203
  - sorbet/config
204
204
  - sorbet/rbi/annotations/faraday.rbi
205
205
  - sorbet/rbi/annotations/mocha.rbi
@@ -243,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
243
  - !ruby/object:Gem::Version
244
244
  version: '0'
245
245
  requirements: []
246
- rubygems_version: 3.2.3
246
+ rubygems_version: 3.3.3
247
247
  signing_key:
248
248
  specification_version: 4
249
249
  summary: Use the Ruby Whatsapp SDK to comunicate with Whatsapp API using the Cloud