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.
- checksums.yaml +4 -4
- data/README.md +47 -32
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a902722670155f70c2bec5d220082f22c428f806d0687dd935e151ebbbdb35
|
4
|
+
data.tar.gz: 81a378266a901accd9b52d196375ff76340d3fa327abe84c16abcc3acd962fe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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.
|
34
|
-
:previewUrl => 'https://www.
|
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 => '
|
44
|
-
}
|
44
|
+
:text => 'Test message'
|
45
|
+
}
|
45
46
|
```
|
46
47
|
|
47
48
|
#### List Payload
|
48
49
|
|
49
50
|
```
|
50
|
-
payload = {
|
51
|
-
|
52
|
-
|
53
|
-
|
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
|
-
:
|
71
|
-
:
|
72
|
-
:
|
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
|
-
:
|
81
|
-
:
|
82
|
-
:
|
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
|
-
:
|
91
|
-
:
|
92
|
-
:
|
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
|
-
:
|
101
|
-
:
|
102
|
-
|
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
|
-
:
|
111
|
-
:
|
112
|
-
:
|
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('
|
134
|
+
g.send('9163xxxxxxxx', payload)
|
120
135
|
```
|
121
136
|
## <a name="testing"></a>Testing
|
122
137
|
To run tests, set the following environmental variables:
|