Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a TwilioServiceMessage class to capture whatsapp user name #82

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d515da8
Updated the stealth dependency to version 2.0
emorissettegregoire May 21, 2020
61b5bb0
Added a generate_suggestions method in reply_handler
emorissettegregoire May 23, 2020
0588ebb
Added template
emorissettegregoire May 23, 2020
a7767e2
Went back to the previous version
emorissettegregoire May 25, 2020
154393f
Resolved conflict
emorissettegregoire Mar 25, 2021
9dccc9e
Add a TwilioServiceMessage class, not finalized yet
emorissettegregoire Mar 26, 2021
30c9648
translated into spanish
emorissettegregoire Mar 26, 2021
8c07388
Add location params in twilio_service_message
emorissettegregoire Mar 26, 2021
c752393
Delete unecessary initialize method
emorissettegregoire Mar 26, 2021
ca6fbdc
Add a reply location, not finalized yet
emorissettegregoire Mar 26, 2021
1c9118a
Finalize whatsapp reply location
emorissettegregoire Mar 27, 2021
5aa9b63
Add a TwilioServiceMessage class to capture whatsapp user name
emorissettegregoire Mar 26, 2021
5da40fc
Merge pull request #1 from emorissettegregoire/service_message
emorissettegregoire Mar 30, 2021
8c7fc6d
Resolve conflicts
emorissettegregoire May 19, 2023
e77efe9
Resolve conflicts
emorissettegregoire May 19, 2023
892d8e1
Uncomment ALPHA_ORDINALS
emorissettegregoire May 19, 2023
a2c09bd
Not using ALPHA_ORDINALS
emorissettegregoire May 19, 2023
df7ddfc
Translate
emorissettegregoire May 19, 2023
51926d4
Back to ALPHA_ORDINALS
emorissettegregoire May 19, 2023
ccd78dc
Uncomment ALPHA_ORDINALS
emorissettegregoire May 19, 2023
891e2fe
Merge branch 'master' into add-twilio-service-message
emorissettegregoire May 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/stealth/services/twilio/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

require 'stealth/services/twilio/message_handler'
require 'stealth/services/twilio/reply_handler'
require 'stealth/services/twilio/twilio_service_message'

require 'stealth/services/twilio/setup'

module Stealth
Expand Down
4 changes: 3 additions & 1 deletion lib/stealth/services/twilio/message_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ def coordinate
end

def process
@service_message = ServiceMessage.new(service: 'twilio')
@service_message = TwilioServiceMessage.new(service: 'twilio')
service_message.sender_id = params['From']
service_message.target_id = params['To']
service_message.message = params['Body']
service_message.display_name = params['ProfileName']
service_message.location = { latitude: params['Latitude'], longitude: params['Longitude'] }

# Check for media attachments
attachment_count = params['NumMedia'].to_i
Expand Down
5 changes: 5 additions & 0 deletions lib/stealth/services/twilio/reply_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def file
format_response({ body: reply['text'], media_url: reply['file_url'] })
end

def location
check_text_length
format_response({ body: reply['text'], persistent_action: ["geo:#{reply['latitude']},#{reply['longitude']}|#{reply['label']}"] })
end

def delay

end
Expand Down
10 changes: 10 additions & 0 deletions lib/stealth/services/twilio/twilio_service_message.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Stealth
module Services
module Twilio
class TwilioServiceMessage < Stealth::ServiceMessage
attr_accessor :display_name

end
end
end
end