@@ -106,15 +106,16 @@ def revoke_channel_token(access_token)
106106 #
107107 # @param user_id [String] User Id
108108 # @param messages [Hash or Array] Message Objects
109+ # @param headers [Hash] HTTP Headers
109110 # @return [Net::HTTPResponse]
110- def push_message ( user_id , messages )
111+ def push_message ( user_id , messages , headers : { } )
111112 channel_token_required
112113
113114 messages = [ messages ] if messages . is_a? ( Hash )
114115
115116 endpoint_path = '/bot/message/push'
116117 payload = { to : user_id , messages : messages } . to_json
117- post ( endpoint , endpoint_path , payload , credentials )
118+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
118119 end
119120
120121 # Reply messages to a user using replyToken.
@@ -151,30 +152,33 @@ def reply_message(token, messages)
151152 #
152153 # @param to [Array or String] Array of userIds
153154 # @param messages [Hash or Array] Message Objects
155+ # @param headers [Hash] HTTP Headers
154156 # @return [Net::HTTPResponse]
155- def multicast ( to , messages )
157+ def multicast ( to , messages , headers : { } )
156158 channel_token_required
157159
158160 to = [ to ] if to . is_a? ( String )
159161 messages = [ messages ] if messages . is_a? ( Hash )
160162
161163 endpoint_path = '/bot/message/multicast'
162164 payload = { to : to , messages : messages } . to_json
163- post ( endpoint , endpoint_path , payload , credentials )
165+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
164166 end
165167
166168 # Send messages to all friends.
167169 #
168170 # @param messages [Hash or Array] Message Objects
171+ # @param headers [Hash] HTTP Headers
172+ #
169173 # @return [Net::HTTPResponse]
170- def broadcast ( messages )
174+ def broadcast ( messages , headers : { } )
171175 channel_token_required
172176
173177 messages = [ messages ] if messages . is_a? ( Hash )
174178
175179 endpoint_path = '/bot/message/broadcast'
176180 payload = { messages : messages } . to_json
177- post ( endpoint , endpoint_path , payload , credentials )
181+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
178182 end
179183
180184 # Narrowcast messages to users
@@ -186,9 +190,10 @@ def broadcast(messages)
186190 # @param recipient [Hash]
187191 # @param filter [Hash]
188192 # @param limit [Hash]
193+ # @param headers [Hash] HTTP Headers
189194 #
190195 # @return [Net::HTTPResponse]
191- def narrowcast ( messages , recipient : nil , filter : nil , limit : nil )
196+ def narrowcast ( messages , recipient : nil , filter : nil , limit : nil , headers : { } )
192197 channel_token_required
193198
194199 messages = [ messages ] if messages . is_a? ( Hash )
@@ -200,7 +205,7 @@ def narrowcast(messages, recipient: nil, filter: nil, limit: nil)
200205 filter : filter ,
201206 limit : limit
202207 } . to_json
203- post ( endpoint , endpoint_path , payload , credentials )
208+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
204209 end
205210
206211 def leave_group ( group_id )
0 commit comments