warb 0.1.4 → 1.0.0
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/.rubocop.yml +5 -12
- data/README.md +9 -32
- data/Rakefile +3 -3
- data/docs/README.md +1 -4
- data/docs/components/README.md +1 -4
- data/docs/messages/README.md +1 -2
- data/docs/messages/flow.md +5 -241
- data/docs/messages/interactive_call_to_action_url.md +9 -9
- data/docs/messages/interactive_list.md +2 -2
- data/docs/messages/interactive_reply_button.md +9 -9
- data/docs/setup.md +1 -45
- data/examples/audio.rb +10 -10
- data/examples/document.rb +34 -34
- data/examples/image.rb +22 -22
- data/examples/interactive_call_to_action_url.rb +46 -46
- data/examples/interactive_list.rb +61 -61
- data/examples/interactive_reply_button.rb +43 -43
- data/examples/location.rb +32 -32
- data/examples/location_request.rb +11 -11
- data/examples/message.rb +8 -8
- data/examples/sticker.rb +10 -10
- data/examples/video.rb +22 -22
- data/examples/webhook.rb +43 -77
- data/lib/warb/client.rb +5 -7
- data/lib/warb/components/action.rb +8 -12
- data/lib/warb/configuration.rb +1 -4
- data/lib/warb/connection.rb +9 -15
- data/lib/warb/dispatcher.rb +3 -4
- data/lib/warb/dispatcher_concern.rb +0 -6
- data/lib/warb/indicator_dispatcher.rb +4 -4
- data/lib/warb/media_dispatcher.rb +10 -10
- data/lib/warb/resources/audio.rb +1 -1
- data/lib/warb/resources/contact.rb +20 -22
- data/lib/warb/resources/document.rb +1 -1
- data/lib/warb/resources/flow.rb +20 -82
- data/lib/warb/resources/image.rb +1 -1
- data/lib/warb/resources/interactive_call_to_action_url.rb +8 -10
- data/lib/warb/resources/interactive_list.rb +5 -7
- data/lib/warb/resources/interactive_reply_button.rb +8 -10
- data/lib/warb/resources/location.rb +1 -11
- data/lib/warb/resources/location_request.rb +3 -5
- data/lib/warb/resources/reaction.rb +1 -1
- data/lib/warb/resources/resource.rb +4 -14
- data/lib/warb/resources/sticker.rb +1 -1
- data/lib/warb/resources/text.rb +3 -31
- data/lib/warb/resources/video.rb +1 -1
- data/lib/warb/utils.rb +1 -3
- data/lib/warb/version.rb +1 -1
- data/lib/warb.rb +31 -67
- metadata +3 -34
- data/docs/components/button.md +0 -62
- data/docs/components/copy_code_button.md +0 -57
- data/docs/components/flow_button.md +0 -102
- data/docs/components/url_button.md +0 -57
- data/docs/messages/template.md +0 -373
- data/docs/resources/README.md +0 -14
- data/docs/resources/currency.md +0 -22
- data/docs/resources/date_time.md +0 -11
- data/docs/resources/text.md +0 -9
- data/lib/warb/category.rb +0 -8
- data/lib/warb/components/button.rb +0 -29
- data/lib/warb/components/component.rb +0 -19
- data/lib/warb/components/copy_code_button.rb +0 -30
- data/lib/warb/components/flow_button.rb +0 -32
- data/lib/warb/components/quick_reply_button.rb +0 -15
- data/lib/warb/components/url_button.rb +0 -30
- data/lib/warb/components/voice_call_button.rb +0 -15
- data/lib/warb/errors.rb +0 -27
- data/lib/warb/language.rb +0 -8
- data/lib/warb/resources/currency.rb +0 -47
- data/lib/warb/resources/date_time.rb +0 -34
- data/lib/warb/resources/helpers/header.rb +0 -35
- data/lib/warb/resources/template.rb +0 -163
- data/lib/warb/resources/validation.rb +0 -30
- data/lib/warb/response.rb +0 -33
- data/lib/warb/response_error_handler.rb +0 -42
- data/lib/warb/template_dispatcher.rb +0 -21
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "../lib/warb"
|
|
4
4
|
|
|
5
5
|
# Configure your variables here
|
|
6
6
|
|
|
7
|
-
access_token =
|
|
8
|
-
business_id =
|
|
9
|
-
sender_id =
|
|
10
|
-
recipient_number =
|
|
7
|
+
access_token = ""
|
|
8
|
+
business_id = ""
|
|
9
|
+
sender_id = ""
|
|
10
|
+
recipient_number = ""
|
|
11
11
|
|
|
12
12
|
# You can use Resources to create headers for your messages.
|
|
13
|
-
text_header = Warb::Resources::Text.as_header(
|
|
13
|
+
text_header = Warb::Resources::Text.as_header("OPTIONAL - Header")
|
|
14
14
|
image_header = Warb::Resources::Image.as_header(media_id: image_id)
|
|
15
15
|
video_header = Warb::Resources::Video.as_header(link: image_url)
|
|
16
16
|
|
|
17
17
|
# You can use Action Components to create actions for your messages.
|
|
18
|
-
action_component = Warb::Components::ReplyButtonAction.new([
|
|
18
|
+
action_component = Warb::Components::ReplyButtonAction.new(["button 1", "button 2", "button 3"])
|
|
19
19
|
|
|
20
20
|
# We recommend testing one section at a time, as it can be overwhelming to see all the messages at once.
|
|
21
21
|
# So you can comment out the sections you don't want to test.
|
|
@@ -33,52 +33,52 @@ end
|
|
|
33
33
|
warb_from_setup.interactive_list.dispatch(
|
|
34
34
|
recipient_number,
|
|
35
35
|
header: text_header,
|
|
36
|
-
body:
|
|
37
|
-
footer:
|
|
36
|
+
body: "body",
|
|
37
|
+
footer: "footer",
|
|
38
38
|
action: action_component
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
warb_from_setup.interactive_list.dispatch(
|
|
42
42
|
recipient_number,
|
|
43
43
|
header: image_header,
|
|
44
|
-
body:
|
|
45
|
-
footer:
|
|
44
|
+
body: "body",
|
|
45
|
+
footer: "footer",
|
|
46
46
|
action: action_component
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
warb_from_setup.interactive_list.dispatch(
|
|
50
50
|
recipient_number,
|
|
51
51
|
header: video_header,
|
|
52
|
-
body:
|
|
53
|
-
footer:
|
|
52
|
+
body: "body",
|
|
53
|
+
footer: "footer",
|
|
54
54
|
action: action_component
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
warb_from_setup.interactive_list.dispatch(recipient_number) do |builder|
|
|
58
58
|
# OPTIONAL Headers: you can choose between text, image, or video headers.
|
|
59
59
|
|
|
60
|
-
builder.
|
|
60
|
+
builder.set_text_header("Text Header")
|
|
61
61
|
|
|
62
62
|
# If you want to use an image header, uncomment the line below and provide a valid or Media ID or Link.
|
|
63
|
-
# builder.
|
|
63
|
+
# builder.set_image_header(media_id: image_id) # or builder.set_image_header(link: image_link)
|
|
64
64
|
|
|
65
65
|
# If you want to use a video header, uncomment the line below and provide a valid Media ID or Link.
|
|
66
|
-
# builder.
|
|
66
|
+
# builder.set_video_header(media_id: video_id) # or builder.set_video_header(link: video_link)
|
|
67
67
|
|
|
68
|
-
builder.body =
|
|
69
|
-
builder.footer =
|
|
68
|
+
builder.body = "body"
|
|
69
|
+
builder.footer = "footer"
|
|
70
70
|
|
|
71
71
|
builder.build_action do |action|
|
|
72
|
-
action.button_text =
|
|
72
|
+
action.button_text = "Action button text"
|
|
73
73
|
|
|
74
74
|
section = action.add_section
|
|
75
|
-
section.title =
|
|
76
|
-
section.rows = [Warb::Components::Row.new(title:
|
|
77
|
-
section.add_row title:
|
|
75
|
+
section.title = "Title"
|
|
76
|
+
section.rows = [Warb::Components::Row.new(title: "S #0 R #0")]
|
|
77
|
+
section.add_row title: "Second Row", description: "Who knows?"
|
|
78
78
|
|
|
79
|
-
section = action.add_section title:
|
|
80
|
-
row = section.add_row title:
|
|
81
|
-
row.description =
|
|
79
|
+
section = action.add_section title: "Second Section"
|
|
80
|
+
row = section.add_row title: "KeK"
|
|
81
|
+
row.description = "Description"
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
@@ -95,52 +95,52 @@ warb_from_new = Warb.new(
|
|
|
95
95
|
warb_from_new.interactive_list.dispatch(
|
|
96
96
|
recipient_number,
|
|
97
97
|
header: text_header,
|
|
98
|
-
body:
|
|
99
|
-
footer:
|
|
98
|
+
body: "body",
|
|
99
|
+
footer: "footer",
|
|
100
100
|
action: action_component
|
|
101
101
|
)
|
|
102
102
|
|
|
103
103
|
warb_from_new.interactive_list.dispatch(
|
|
104
104
|
recipient_number,
|
|
105
105
|
header: image_header,
|
|
106
|
-
body:
|
|
107
|
-
footer:
|
|
106
|
+
body: "body",
|
|
107
|
+
footer: "footer",
|
|
108
108
|
action: action_component
|
|
109
109
|
)
|
|
110
110
|
|
|
111
111
|
warb_from_new.interactive_list.dispatch(
|
|
112
112
|
recipient_number,
|
|
113
113
|
header: video_header,
|
|
114
|
-
body:
|
|
115
|
-
footer:
|
|
114
|
+
body: "body",
|
|
115
|
+
footer: "footer",
|
|
116
116
|
action: action_component
|
|
117
117
|
)
|
|
118
118
|
|
|
119
119
|
warb_from_new.interactive_list.dispatch(recipient_number) do |builder|
|
|
120
120
|
# OPTIONAL Headers: you can choose between text, image, or video headers.
|
|
121
121
|
|
|
122
|
-
builder.
|
|
122
|
+
builder.set_text_header("Text Header")
|
|
123
123
|
|
|
124
124
|
# If you want to use an image header, uncomment the line below and provide a valid or Media ID or Link.
|
|
125
|
-
# builder.
|
|
125
|
+
# builder.set_image_header(media_id: image_id) # or builder.set_image_header(link: image_link)
|
|
126
126
|
|
|
127
127
|
# If you want to use a video header, uncomment the line below and provide a valid Media ID or Link.
|
|
128
|
-
# builder.
|
|
128
|
+
# builder.set_video_header(media_id: video_id) # or builder.set_video_header(link: video_link)
|
|
129
129
|
|
|
130
|
-
builder.body =
|
|
131
|
-
builder.footer =
|
|
130
|
+
builder.body = "body"
|
|
131
|
+
builder.footer = "footer"
|
|
132
132
|
|
|
133
133
|
builder.build_action do |action|
|
|
134
|
-
action.button_text =
|
|
134
|
+
action.button_text = "Action button text"
|
|
135
135
|
|
|
136
136
|
section = action.add_section
|
|
137
|
-
section.title =
|
|
138
|
-
section.rows = [Warb::Components::Row.new(title:
|
|
139
|
-
section.add_row title:
|
|
137
|
+
section.title = "Title"
|
|
138
|
+
section.rows = [Warb::Components::Row.new(title: "S #0 R #0")]
|
|
139
|
+
section.add_row title: "Second Row", description: "Who knows?"
|
|
140
140
|
|
|
141
|
-
section = action.add_section title:
|
|
142
|
-
row = section.add_row title:
|
|
143
|
-
row.description =
|
|
141
|
+
section = action.add_section title: "Second Section"
|
|
142
|
+
row = section.add_row title: "KeK"
|
|
143
|
+
row.description = "Description"
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
|
@@ -151,51 +151,51 @@ end
|
|
|
151
151
|
Warb.interactive_list.dispatch(
|
|
152
152
|
recipient_number,
|
|
153
153
|
header: text_header,
|
|
154
|
-
body:
|
|
155
|
-
footer:
|
|
154
|
+
body: "body",
|
|
155
|
+
footer: "footer",
|
|
156
156
|
action: action_component
|
|
157
157
|
)
|
|
158
158
|
|
|
159
159
|
Warb.interactive_list.dispatch(
|
|
160
160
|
recipient_number,
|
|
161
161
|
header: image_header,
|
|
162
|
-
body:
|
|
163
|
-
footer:
|
|
162
|
+
body: "body",
|
|
163
|
+
footer: "footer",
|
|
164
164
|
action: action_component
|
|
165
165
|
)
|
|
166
166
|
|
|
167
167
|
Warb.interactive_list.dispatch(
|
|
168
168
|
recipient_number,
|
|
169
169
|
header: video_header,
|
|
170
|
-
body:
|
|
171
|
-
footer:
|
|
170
|
+
body: "body",
|
|
171
|
+
footer: "footer",
|
|
172
172
|
action: action_component
|
|
173
173
|
)
|
|
174
174
|
|
|
175
175
|
Warb.interactive_list.dispatch(recipient_number) do |builder|
|
|
176
176
|
# OPTIONAL Headers: you can choose between text, image, or video headers.
|
|
177
177
|
|
|
178
|
-
builder.
|
|
178
|
+
builder.set_text_header("Text Header")
|
|
179
179
|
|
|
180
180
|
# If you want to use an image header, uncomment the line below and provide a valid or Media ID or Link.
|
|
181
|
-
# builder.
|
|
181
|
+
# builder.set_image_header(media_id: image_id) # or builder.set_image_header(link: image_link)
|
|
182
182
|
|
|
183
183
|
# If you want to use a video header, uncomment the line below and provide a valid Media ID or Link.
|
|
184
|
-
# builder.
|
|
184
|
+
# builder.set_video_header(media_id: video_id) # or builder.set_video_header(link: video_link)
|
|
185
185
|
|
|
186
|
-
builder.body =
|
|
187
|
-
builder.footer =
|
|
186
|
+
builder.body = "body"
|
|
187
|
+
builder.footer = "footer"
|
|
188
188
|
|
|
189
189
|
builder.build_action do |action|
|
|
190
|
-
action.button_text =
|
|
190
|
+
action.button_text = "Action button text"
|
|
191
191
|
|
|
192
192
|
section = action.add_section
|
|
193
|
-
section.title =
|
|
194
|
-
section.rows = [Warb::Components::Row.new(title:
|
|
195
|
-
section.add_row title:
|
|
193
|
+
section.title = "Title"
|
|
194
|
+
section.rows = [Warb::Components::Row.new(title: "S #0 R #0")]
|
|
195
|
+
section.add_row title: "Second Row", description: "Who knows?"
|
|
196
196
|
|
|
197
|
-
section = action.add_section title:
|
|
198
|
-
row = section.add_row title:
|
|
199
|
-
row.description =
|
|
197
|
+
section = action.add_section title: "Second Section"
|
|
198
|
+
row = section.add_row title: "KeK"
|
|
199
|
+
row.description = "Description"
|
|
200
200
|
end
|
|
201
201
|
end
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "../lib/warb"
|
|
4
4
|
|
|
5
5
|
# Configure your variables here
|
|
6
6
|
|
|
7
|
-
access_token =
|
|
8
|
-
business_id =
|
|
9
|
-
sender_id =
|
|
10
|
-
recipient_number =
|
|
7
|
+
access_token = ""
|
|
8
|
+
business_id = ""
|
|
9
|
+
sender_id = ""
|
|
10
|
+
recipient_number = ""
|
|
11
11
|
|
|
12
12
|
# You can use Resources to create headers for your messages.
|
|
13
|
-
text_header = Warb::Resources::Text.as_header(
|
|
13
|
+
text_header = Warb::Resources::Text.as_header("OPTIONAL - Header")
|
|
14
14
|
image_header = Warb::Resources::Image.as_header(media_id: image_id)
|
|
15
15
|
video_header = Warb::Resources::Video.as_header(link: image_url)
|
|
16
16
|
|
|
17
17
|
# You can use Action Components to create actions for your messages.
|
|
18
|
-
action_component = Warb::Components::ReplyButtonAction.new([
|
|
18
|
+
action_component = Warb::Components::ReplyButtonAction.new(["button 1", "button 2", "button 3"])
|
|
19
19
|
|
|
20
20
|
# We recommend testing one section at a time, as it can be overwhelming to see all the messages at once.
|
|
21
21
|
# So you can comment out the sections you don't want to test.
|
|
@@ -33,43 +33,43 @@ end
|
|
|
33
33
|
warb_from_setup.interactive_reply_button.dispatch(
|
|
34
34
|
recipient_number,
|
|
35
35
|
header: text_header,
|
|
36
|
-
body:
|
|
37
|
-
footer:
|
|
36
|
+
body: "body",
|
|
37
|
+
footer: "footer",
|
|
38
38
|
action: action_component
|
|
39
39
|
)
|
|
40
40
|
|
|
41
41
|
warb_from_setup.interactive_reply_button.dispatch(
|
|
42
42
|
recipient_number,
|
|
43
43
|
header: image_header,
|
|
44
|
-
body:
|
|
45
|
-
footer:
|
|
44
|
+
body: "body",
|
|
45
|
+
footer: "footer",
|
|
46
46
|
action: action_component
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
warb_from_setup.interactive_reply_button.dispatch(
|
|
50
50
|
recipient_number,
|
|
51
51
|
header: video_header,
|
|
52
|
-
body:
|
|
53
|
-
footer:
|
|
52
|
+
body: "body",
|
|
53
|
+
footer: "footer",
|
|
54
54
|
action: action_component
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
warb_from_setup.interactive_reply_button.dispatch(recipient_number) do |builder|
|
|
58
58
|
# OPTIONAL Headers: you can choose between text, image, or video headers.
|
|
59
59
|
|
|
60
|
-
builder.
|
|
60
|
+
builder.set_text_header("Text Header")
|
|
61
61
|
|
|
62
62
|
# If you want to use an image header, uncomment the line below and provide a valid or Media ID or Link.
|
|
63
|
-
# builder.
|
|
63
|
+
# builder.set_image_header(media_id: image_id) # or builder.set_image_header(link: image_link)
|
|
64
64
|
|
|
65
65
|
# If you want to use a video header, uncomment the line below and provide a valid Media ID or Link.
|
|
66
|
-
# builder.
|
|
66
|
+
# builder.set_video_header(media_id: video_id) # or builder.set_video_header(link: video_link)
|
|
67
67
|
|
|
68
|
-
builder.body =
|
|
69
|
-
builder.footer =
|
|
68
|
+
builder.body = "body"
|
|
69
|
+
builder.footer = "footer"
|
|
70
70
|
|
|
71
71
|
builder.build_action do |action|
|
|
72
|
-
action.buttons_texts = [
|
|
72
|
+
action.buttons_texts = ["button 1", "button 2", "button 3"]
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -86,43 +86,43 @@ warb_from_new = Warb.new(
|
|
|
86
86
|
warb_from_new.interactive_reply_button.dispatch(
|
|
87
87
|
recipient_number,
|
|
88
88
|
header: text_header,
|
|
89
|
-
body:
|
|
90
|
-
footer:
|
|
89
|
+
body: "body",
|
|
90
|
+
footer: "footer",
|
|
91
91
|
action: action_component
|
|
92
92
|
)
|
|
93
93
|
|
|
94
94
|
warb_from_new.interactive_reply_button.dispatch(
|
|
95
95
|
recipient_number,
|
|
96
96
|
header: image_header,
|
|
97
|
-
body:
|
|
98
|
-
footer:
|
|
97
|
+
body: "body",
|
|
98
|
+
footer: "footer",
|
|
99
99
|
action: action_component
|
|
100
100
|
)
|
|
101
101
|
|
|
102
102
|
warb_from_new.interactive_reply_button.dispatch(
|
|
103
103
|
recipient_number,
|
|
104
104
|
header: video_header,
|
|
105
|
-
body:
|
|
106
|
-
footer:
|
|
105
|
+
body: "body",
|
|
106
|
+
footer: "footer",
|
|
107
107
|
action: action_component
|
|
108
108
|
)
|
|
109
109
|
|
|
110
110
|
warb_from_new.interactive_reply_button.dispatch(recipient_number) do |builder|
|
|
111
111
|
# OPTIONAL Headers: you can choose between text, image, or video headers.
|
|
112
112
|
|
|
113
|
-
builder.
|
|
113
|
+
builder.set_text_header("Text Header")
|
|
114
114
|
|
|
115
115
|
# If you want to use an image header, uncomment the line below and provide a valid or Media ID or Link.
|
|
116
|
-
# builder.
|
|
116
|
+
# builder.set_image_header(media_id: image_id) # or builder.set_image_header(link: image_link)
|
|
117
117
|
|
|
118
118
|
# If you want to use a video header, uncomment the line below and provide a valid Media ID or Link.
|
|
119
|
-
# builder.
|
|
119
|
+
# builder.set_video_header(media_id: video_id) # or builder.set_video_header(link: video_link)
|
|
120
120
|
|
|
121
|
-
builder.body =
|
|
122
|
-
builder.footer =
|
|
121
|
+
builder.body = "body"
|
|
122
|
+
builder.footer = "footer"
|
|
123
123
|
|
|
124
124
|
builder.build_action do |action|
|
|
125
|
-
action.buttons_texts = [
|
|
125
|
+
action.buttons_texts = ["button 1", "button 2", "button 3"]
|
|
126
126
|
end
|
|
127
127
|
end
|
|
128
128
|
|
|
@@ -133,42 +133,42 @@ end
|
|
|
133
133
|
Warb.interactive_reply_button.dispatch(
|
|
134
134
|
recipient_number,
|
|
135
135
|
header: text_header,
|
|
136
|
-
body:
|
|
137
|
-
footer:
|
|
136
|
+
body: "body",
|
|
137
|
+
footer: "footer",
|
|
138
138
|
action: action_component
|
|
139
139
|
)
|
|
140
140
|
|
|
141
141
|
Warb.interactive_reply_button.dispatch(
|
|
142
142
|
recipient_number,
|
|
143
143
|
header: image_header,
|
|
144
|
-
body:
|
|
145
|
-
footer:
|
|
144
|
+
body: "body",
|
|
145
|
+
footer: "footer",
|
|
146
146
|
action: action_component
|
|
147
147
|
)
|
|
148
148
|
|
|
149
149
|
Warb.interactive_reply_button.dispatch(
|
|
150
150
|
recipient_number,
|
|
151
151
|
header: video_header,
|
|
152
|
-
body:
|
|
153
|
-
footer:
|
|
152
|
+
body: "body",
|
|
153
|
+
footer: "footer",
|
|
154
154
|
action: action_component
|
|
155
155
|
)
|
|
156
156
|
|
|
157
157
|
Warb.interactive_reply_button.dispatch(recipient_number) do |builder|
|
|
158
158
|
# OPTIONAL Headers: you can choose between text, image, or video headers.
|
|
159
159
|
|
|
160
|
-
builder.
|
|
160
|
+
builder.set_text_header("Text Header")
|
|
161
161
|
|
|
162
162
|
# If you want to use an image header, uncomment the line below and provide a valid or Media ID or Link.
|
|
163
|
-
# builder.
|
|
163
|
+
# builder.set_image_header(media_id: image_id) # or builder.set_image_header(link: image_link)
|
|
164
164
|
|
|
165
165
|
# If you want to use a video header, uncomment the line below and provide a valid Media ID or Link.
|
|
166
|
-
# builder.
|
|
166
|
+
# builder.set_video_header(media_id: video_id) # or builder.set_video_header(link: video_link)
|
|
167
167
|
|
|
168
|
-
builder.body =
|
|
169
|
-
builder.footer =
|
|
168
|
+
builder.body = "body"
|
|
169
|
+
builder.footer = "footer"
|
|
170
170
|
|
|
171
171
|
builder.build_action do |action|
|
|
172
|
-
action.buttons_texts = [
|
|
172
|
+
action.buttons_texts = ["button 1", "button 2", "button 3"]
|
|
173
173
|
end
|
|
174
174
|
end
|
data/examples/location.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "../lib/warb"
|
|
4
4
|
|
|
5
5
|
# Configure your variables here
|
|
6
6
|
|
|
7
|
-
access_token =
|
|
8
|
-
business_id =
|
|
9
|
-
sender_id =
|
|
10
|
-
recipient_number =
|
|
7
|
+
access_token = ""
|
|
8
|
+
business_id = ""
|
|
9
|
+
sender_id = ""
|
|
10
|
+
recipient_number = ""
|
|
11
11
|
|
|
12
12
|
# We recommend testing one section at a time, as it can be overwhelming to see all the messages at once.
|
|
13
13
|
# So you can comment out the sections you don't want to test.
|
|
@@ -22,20 +22,20 @@ warb_from_setup = Warb.setup do |config|
|
|
|
22
22
|
config.sender_id = sender_id
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
warb_from_setup.location.dispatch(recipient_number, latitude:
|
|
25
|
+
warb_from_setup.location.dispatch(recipient_number, latitude: "37.44216251868683", longitude: "-122.16153582049394")
|
|
26
26
|
warb_from_setup.location.dispatch(
|
|
27
27
|
recipient_number,
|
|
28
|
-
latitude:
|
|
29
|
-
longitude:
|
|
30
|
-
name:
|
|
31
|
-
address:
|
|
28
|
+
latitude: "37.44216251868683",
|
|
29
|
+
longitude: "-122.16153582049394",
|
|
30
|
+
name: "OPTIONAL - Location Name",
|
|
31
|
+
address: "OPTIONAL - Location Address"
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
warb_from_setup.location.dispatch(recipient_number) do |builder|
|
|
35
|
-
builder.latitude =
|
|
36
|
-
builder.longitude =
|
|
37
|
-
builder.name =
|
|
38
|
-
builder.address =
|
|
35
|
+
builder.latitude = "37.44216251868683"
|
|
36
|
+
builder.longitude = "-122.16153582049394"
|
|
37
|
+
builder.name = "OPTIONAL - Location Name"
|
|
38
|
+
builder.address = "OPTIONAL - Location Address"
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# ############################################ #
|
|
@@ -48,38 +48,38 @@ warb_from_new = Warb.new(
|
|
|
48
48
|
sender_id: sender_id
|
|
49
49
|
)
|
|
50
50
|
|
|
51
|
-
warb_from_new.location.dispatch(recipient_number, latitude:
|
|
51
|
+
warb_from_new.location.dispatch(recipient_number, latitude: "37.44216251868683", longitude: "-122.16153582049394")
|
|
52
52
|
warb_from_new.location.dispatch(
|
|
53
53
|
recipient_number,
|
|
54
|
-
latitude:
|
|
55
|
-
longitude:
|
|
56
|
-
name:
|
|
57
|
-
address:
|
|
54
|
+
latitude: "37.44216251868683",
|
|
55
|
+
longitude: "-122.16153582049394",
|
|
56
|
+
name: "OPTIONAL - Location Name",
|
|
57
|
+
address: "OPTIONAL - Location Address"
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
warb_from_new.location.dispatch(recipient_number) do |builder|
|
|
61
|
-
builder.latitude =
|
|
62
|
-
builder.longitude =
|
|
63
|
-
builder.name =
|
|
64
|
-
builder.address =
|
|
61
|
+
builder.latitude = "37.44216251868683"
|
|
62
|
+
builder.longitude = "-122.16153582049394"
|
|
63
|
+
builder.name = "OPTIONAL - Location Name"
|
|
64
|
+
builder.address = "OPTIONAL - Location Address"
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
# ################################################# #
|
|
68
68
|
# ============== Using Warb directly ============== #
|
|
69
69
|
# ################################################# #
|
|
70
70
|
|
|
71
|
-
Warb.location.dispatch(recipient_number, latitude:
|
|
71
|
+
Warb.location.dispatch(recipient_number, latitude: "37.44216251868683", longitude: "-122.16153582049394")
|
|
72
72
|
Warb.location.dispatch(
|
|
73
73
|
recipient_number,
|
|
74
|
-
latitude:
|
|
75
|
-
longitude:
|
|
76
|
-
name:
|
|
77
|
-
address:
|
|
74
|
+
latitude: "37.44216251868683",
|
|
75
|
+
longitude: "-122.16153582049394",
|
|
76
|
+
name: "OPTIONAL - Location Name",
|
|
77
|
+
address: "OPTIONAL - Location Address"
|
|
78
78
|
)
|
|
79
79
|
|
|
80
80
|
Warb.location.dispatch(recipient_number) do |builder|
|
|
81
|
-
builder.latitude =
|
|
82
|
-
builder.longitude =
|
|
83
|
-
builder.name =
|
|
84
|
-
builder.address =
|
|
81
|
+
builder.latitude = "37.44216251868683"
|
|
82
|
+
builder.longitude = "-122.16153582049394"
|
|
83
|
+
builder.name = "OPTIONAL - Location Name"
|
|
84
|
+
builder.address = "OPTIONAL - Location Address"
|
|
85
85
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "../lib/warb"
|
|
4
4
|
|
|
5
5
|
# Configure your variables here
|
|
6
6
|
|
|
7
|
-
access_token =
|
|
8
|
-
business_id =
|
|
9
|
-
sender_id =
|
|
10
|
-
recipient_number =
|
|
7
|
+
access_token = ""
|
|
8
|
+
business_id = ""
|
|
9
|
+
sender_id = ""
|
|
10
|
+
recipient_number = ""
|
|
11
11
|
|
|
12
12
|
# We recommend testing one section at a time, as it can be overwhelming to see all the messages at once.
|
|
13
13
|
# So you can comment out the sections you don't want to test.
|
|
@@ -22,10 +22,10 @@ warb_from_setup = Warb.setup do |config|
|
|
|
22
22
|
config.sender_id = sender_id
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
warb_from_setup.location_request.dispatch(recipient_number, body_text:
|
|
25
|
+
warb_from_setup.location_request.dispatch(recipient_number, body_text: "Location request body text")
|
|
26
26
|
|
|
27
27
|
warb_from_setup.location_request.dispatch(recipient_number) do |builder|
|
|
28
|
-
builder.body_text =
|
|
28
|
+
builder.body_text = "Location request body text"
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# ############################################ #
|
|
@@ -38,18 +38,18 @@ warb_from_new = Warb.new(
|
|
|
38
38
|
sender_id: sender_id
|
|
39
39
|
)
|
|
40
40
|
|
|
41
|
-
warb_from_new.location_request.dispatch(recipient_number, body_text:
|
|
41
|
+
warb_from_new.location_request.dispatch(recipient_number, body_text: "Location request body text")
|
|
42
42
|
|
|
43
43
|
warb_from_new.location_request.dispatch(recipient_number) do |builder|
|
|
44
|
-
builder.body_text =
|
|
44
|
+
builder.body_text = "Location request body text"
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# ################################################# #
|
|
48
48
|
# ============== Using Warb directly ============== #
|
|
49
49
|
# ################################################# #
|
|
50
50
|
|
|
51
|
-
Warb.location_request.dispatch(recipient_number, body_text:
|
|
51
|
+
Warb.location_request.dispatch(recipient_number, body_text: "Location request body text")
|
|
52
52
|
|
|
53
53
|
Warb.location_request.dispatch(recipient_number) do |builder|
|
|
54
|
-
builder.body_text =
|
|
54
|
+
builder.body_text = "Location request body text"
|
|
55
55
|
end
|
data/examples/message.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
3
|
+
require_relative "../lib/warb"
|
|
4
4
|
|
|
5
5
|
# Configure your variables here
|
|
6
6
|
|
|
7
|
-
access_token =
|
|
8
|
-
business_id =
|
|
9
|
-
sender_id =
|
|
10
|
-
recipient_number =
|
|
7
|
+
access_token = ""
|
|
8
|
+
business_id = ""
|
|
9
|
+
sender_id = ""
|
|
10
|
+
recipient_number = ""
|
|
11
11
|
|
|
12
12
|
# We recommend testing one section at a time, as it can be overwhelming to see all the messages at once.
|
|
13
13
|
# So you can comment out the sections you don't want to test.
|
|
@@ -27,7 +27,7 @@ warb_from_setup.message.dispatch(recipient_number, message: 'Hello from warb! Me
|
|
|
27
27
|
warb_from_setup.message.dispatch(recipient_number, text: 'Hello from warb! Message sent with "text" key')
|
|
28
28
|
|
|
29
29
|
warb_from_setup.message.dispatch(recipient_number) do |builder|
|
|
30
|
-
builder.content =
|
|
30
|
+
builder.content = "Hello from warb! Message sent with block builder"
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
# ############################################ #
|
|
@@ -45,7 +45,7 @@ warb_from_new.message.dispatch(recipient_number, message: 'Hello from warb! Mess
|
|
|
45
45
|
warb_from_new.message.dispatch(recipient_number, text: 'Hello from warb! Message sent with "text" key')
|
|
46
46
|
|
|
47
47
|
warb_from_new.message.dispatch(recipient_number) do |builder|
|
|
48
|
-
builder.content =
|
|
48
|
+
builder.content = "Hello from warb! Message sent with block builder"
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# ################################################# #
|
|
@@ -57,5 +57,5 @@ Warb.message.dispatch(recipient_number, message: 'Hello from warb! Message sent
|
|
|
57
57
|
Warb.message.dispatch(recipient_number, text: 'Hello from warb! Message sent with "text" key')
|
|
58
58
|
|
|
59
59
|
Warb.message.dispatch(recipient_number) do |builder|
|
|
60
|
-
builder.content =
|
|
60
|
+
builder.content = "Hello from warb! Message sent with block builder"
|
|
61
61
|
end
|