gupshup_whatsapp 1.0.6 → 1.0.7

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +47 -32
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8061c5b019b240b7a5ab3ea331a7b4e009d75d6f402d9640fef694016c5cfe90
4
- data.tar.gz: 70c89c1ced81c7c93de714cb61c0d0473921df830793703d5a00f664dbfaf197
3
+ metadata.gz: 73a902722670155f70c2bec5d220082f22c428f806d0687dd935e151ebbbdb35
4
+ data.tar.gz: 81a378266a901accd9b52d196375ff76340d3fa327abe84c16abcc3acd962fe4
5
5
  SHA512:
6
- metadata.gz: e2f41516bceef0aabe5cb27815eb28b91603c480ca8358ed771011f1e499745aa1c4f082df72d7a29f09ffe4f9a867f5a30460763d11c4d1b2f3bada15f46245
7
- data.tar.gz: 4d20952dbce737d46c74e192f3a150fe93bdf207c58db59a320d924c175c42e1ce9e6dde6e0462884f88bbd23b1aa0eb8be1bab9e28a50ae5fa49d4ded89cb24
6
+ metadata.gz: a8d8416215fe8f8bacce18544b4b1331262710b2d14da18ea3e0bdc9c4679a85030296f27e4c4b1c2abba61375c4bd787e840490362c9ba60473754564a87276
7
+ data.tar.gz: e19bed07685ade4f84084379587c03ec48c6805faf45b67da2b0d7687b8fc9ea0b7ee333f1ac9293f7f1a45d45658438b3fd47e6b843b943790a1b9ac40179fe
data/README.md CHANGED
@@ -25,13 +25,14 @@ To test, refer to [Testing](#testing)
25
25
 
26
26
  Use the Gupshup API [docs](https://www.gupshup.io/developer/docs/bot-platform/guide/whatsapp-api-documentation) to construct the payload for a message type.
27
27
 
28
- For example:
28
+ Refer to gem [documentation](https://thundersparkf.gitlab.io/gupshup-whatsapp-sdk/Gupshup/REST/OutboundMessage.html) for the methods and their required parameters
29
29
  #### Image payload:
30
30
  ```
31
31
  payload = {
32
32
  :type => "image",
33
- :originalUrl => 'https://www.chatwoot.com/docs/img/logo.png',
34
- :previewUrl => 'https://www.chatwoot.com/docs/img/logo.png'
33
+ :originalUrl => 'https://www.buildquickbots.com/whatsapp/media/sample/jpg/sample01.jpg',
34
+ :previewUrl => 'https://www.buildquickbots.com/whatsapp/media/sample/jpg/sample02.jpg',
35
+ :caption => 'Test Image'
35
36
  }
36
37
  ```
37
38
  #### Text Payload
@@ -40,18 +41,31 @@ payload = {
40
41
  payload = {
41
42
  :isHSM => false,
42
43
  :type => "text",
43
- :text => 'Hi Hello'
44
- }
44
+ :text => 'Test message'
45
+ }
45
46
  ```
46
47
 
47
48
  #### List Payload
48
49
 
49
50
  ```
50
- payload = {
51
- :isHSM => false,
52
- :type => "text",
53
- :text => 'Hi Hello'
54
- }
51
+ payload = { :type => 'list',
52
+ :title => 'Rspec tests',
53
+ :body => 'This is rspec testing body',
54
+ :globalButtons => [{ :type => 'text', :title => 'Test List' }],
55
+ :items =>[
56
+ { "title": "first Section", "subtitle": "first Subtitle", "options": [
57
+ { "type": "text", "title": "section 1 row 1", "description": "first row of first section description", "postbackText": "section 1 row 1 postback payload" },
58
+ { "type": "text", "title": "section 1 row 2", "description": "second row of first section description", "postbackText": "section 1 row 2 postback payload" },
59
+ { "type": "text", "title": "section 1 row 3", "description": "third row of first section description", "postbackText": "section 1 row 3 postback payload" } ]
60
+ },
61
+ {
62
+ "title": "second section", "subtitle": "second Subtitle", "options": [
63
+ { "type": "text", "title": "section 2 row 1", "description": "first row of second section description", "postbackText": "section 1 row 3 postback payload" }
64
+ ]
65
+ }
66
+ ]
67
+ }
68
+
55
69
  ```
56
70
 
57
71
  #### Sticker Payload
@@ -67,56 +81,57 @@ payload = {
67
81
 
68
82
  ```
69
83
  payload = {
70
- :isHSM => false,
71
- :type => "text",
72
- :text => 'Hi Hello'
73
- }
84
+ :type => "video",
85
+ :url => 'https://www.buildquickbots.com/whatsapp/media/sample/video/sample01.mp4',
86
+ :caption => 'Test Video'
87
+ }
74
88
  ```
75
89
 
76
90
  #### Files Payload
77
91
 
78
92
  ```
79
93
  payload = {
80
- :isHSM => false,
81
- :type => "text",
82
- :text => 'Hi Hello'
83
- }
94
+ :type => "file",
95
+ :url => 'https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf',
96
+ :filename => 'Test file'
97
+ }
84
98
  ```
85
99
 
86
100
  #### Text Payload
87
101
 
88
102
  ```
89
- payload = {
90
- :isHSM => false,
91
- :type => "text",
92
- :text => 'Hi Hello'
93
- }
103
+ payload = {
104
+ :type => "quick_reply",
105
+ :content => {"type":"text", "text": "Fave book?", "caption": "Malatesta edition"},
106
+ :options => [{ "title": "Anarchy"}, {"title": "Anarchists vs plague"}]}
107
+
94
108
  ```
95
109
 
96
110
  #### Audio Payload
97
111
 
98
112
  ```
99
113
  payload = {
100
- :isHSM => false,
101
- :type => "text",
102
- :text => 'Hi Hello'
103
- }
114
+ :type => "audio",
115
+ :url => 'https://www.buildquickbots.com/whatsapp/media/sample/audio/sample01.mp3'
116
+ }
104
117
  ```
105
118
 
106
119
  #### Location Payload
107
120
 
108
121
  ```
109
122
  payload = {
110
- :isHSM => false,
111
- :type => "text",
112
- :text => 'Hi Hello'
113
- }
123
+ :type => "location",
124
+ :longitude => 43.43,
125
+ :latitude => 33.34,
126
+ :name => "Test name",
127
+ :address => "Test address"
128
+ }
114
129
  ```
115
130
 
116
131
  After this, run the following commands in your code after replacing the credentials and phone number:
117
132
  ```
118
133
  g = Gupshup::WhatsApp.new(app, apikey, phone_number, version='2')
119
- g.send('916383467769', payload)
134
+ g.send('9163xxxxxxxx', payload)
120
135
  ```
121
136
  ## <a name="testing"></a>Testing
122
137
  To run tests, set the following environmental variables:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gupshup_whatsapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - thundersparkf