Skip to content

Commit f7d57fd

Browse files
committed
Logging WhatsApp Cloud API requests and responses. (#2296)
Also, fixing a trailing white space (reported by Code Climate). Reference: CV2-6356.
1 parent e0b3cf5 commit f7d57fd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

app/models/concerns/smooch_capi.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ def capi_send_message_to_user(uid, text, extra = {}, _force = false, preview_url
279279
req = Net::HTTP::Post.new(uri.request_uri, 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{self.config['capi_permanent_token']}")
280280
req.body = payload.to_json
281281
response = http.request(req)
282+
Rails.logger.info("[Smooch Bot] [WhatsApp Cloud API] Sending message to #{uid} for number #{self.config['capi_phone_number_id']}. URL: #{uri} Request: #{payload.to_json}; Response: #{response.body}")
282283
if response.code.to_i >= 400
283284
error_message = begin JSON.parse(response.body)['error']['message'] rescue response.body end
284285
error_code = begin JSON.parse(response.body)['error']['code'] rescue nil end

0 commit comments

Comments
 (0)