kogno 1.0.1
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 +7 -0
- data/bin/kogno +92 -0
- data/lib/boot.rb +9 -0
- data/lib/core/bin_helpers/messenger_ctl.rb +48 -0
- data/lib/core/bin_helpers/scaffolding.rb +203 -0
- data/lib/core/bin_helpers/scheduled_messages_ctl.rb +95 -0
- data/lib/core/bin_helpers/sequences_ctl.rb +95 -0
- data/lib/core/bin_helpers/server_ctl.rb +127 -0
- data/lib/core/bin_helpers/telegram_ctl.rb +48 -0
- data/lib/core/bin_helpers/webhook_ctl.rb +96 -0
- data/lib/core/db.rb +8 -0
- data/lib/core/extensions/array.rb +28 -0
- data/lib/core/extensions/hash.rb +12 -0
- data/lib/core/extensions/logger.rb +70 -0
- data/lib/core/extensions/string.rb +6 -0
- data/lib/core/extensions/wit.rb +60 -0
- data/lib/core/global_methods.rb +67 -0
- data/lib/core/helpers/string.rb +105 -0
- data/lib/core/lib/base_config.rb +17 -0
- data/lib/core/lib/block_params.rb +4 -0
- data/lib/core/lib/context.rb +1573 -0
- data/lib/core/lib/error_handler.rb +36 -0
- data/lib/core/lib/message.rb +182 -0
- data/lib/core/lib/messenger/api.rb +281 -0
- data/lib/core/lib/messenger/facebook_graph.rb +32 -0
- data/lib/core/lib/messenger/message.rb +202 -0
- data/lib/core/lib/messenger/notification.rb +351 -0
- data/lib/core/lib/messenger/post_comment.rb +104 -0
- data/lib/core/lib/messenger/recurring_notification.rb +81 -0
- data/lib/core/lib/nlp.rb +191 -0
- data/lib/core/lib/notification.rb +371 -0
- data/lib/core/lib/spelling.rb +13 -0
- data/lib/core/lib/telegram/api.rb +197 -0
- data/lib/core/lib/telegram/chat_activity.rb +111 -0
- data/lib/core/lib/telegram/inline_query.rb +112 -0
- data/lib/core/lib/telegram/message.rb +327 -0
- data/lib/core/lib/telegram/notification.rb +507 -0
- data/lib/core/lib/whatsapp/api.rb +153 -0
- data/lib/core/lib/whatsapp/message.rb +132 -0
- data/lib/core/lib/whatsapp/notification.rb +206 -0
- data/lib/core/lib/whatsapp/status_message.rb +58 -0
- data/lib/core/loaders/config_files.rb +15 -0
- data/lib/core/models/chat_log.rb +4 -0
- data/lib/core/models/long_payload.rb +25 -0
- data/lib/core/models/matched_message.rb +5 -0
- data/lib/core/models/messenger_recurring_notification.rb +16 -0
- data/lib/core/models/scheduled_message.rb +40 -0
- data/lib/core/models/sequence.rb +29 -0
- data/lib/core/models/telegram_chat_group.rb +26 -0
- data/lib/core/models/user.rb +285 -0
- data/lib/core/web/webhook.rb +198 -0
- data/lib/kogno.rb +130 -0
- data/scaffolding/new_project/Gemfile +3 -0
- data/scaffolding/new_project/application.rb +5 -0
- data/scaffolding/new_project/bot/contexts/main_context.rb +10 -0
- data/scaffolding/new_project/bot/conversation.rb +14 -0
- data/scaffolding/new_project/bot/models/user.rb +3 -0
- data/scaffolding/new_project/config/application.rb +28 -0
- data/scaffolding/new_project/config/database.yml +8 -0
- data/scaffolding/new_project/config/locales/en.yml +4 -0
- data/scaffolding/new_project/config/locales/es.yml +3 -0
- data/scaffolding/new_project/config/nlp.rb +23 -0
- data/scaffolding/new_project/config/platforms/messenger.rb +74 -0
- data/scaffolding/new_project/config/platforms/telegram.rb +45 -0
- data/scaffolding/new_project/config/platforms/whatsapp.rb +13 -0
- data/scaffolding/new_project/web/routes.rb +10 -0
- metadata +220 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
Kogno::Application.configure do |config|
|
2
|
+
|
3
|
+
config.nlp.wit = {
|
4
|
+
enable: false,
|
5
|
+
api_version: "20210928",
|
6
|
+
apps: {
|
7
|
+
default: "YOUR_WIT_ACCESS_TOKEN"
|
8
|
+
}
|
9
|
+
}
|
10
|
+
|
11
|
+
# Several wit projecs for each languages
|
12
|
+
|
13
|
+
# config.nlp.wit = {
|
14
|
+
# enable: false,
|
15
|
+
# api_version: "20210928",
|
16
|
+
# apps: {
|
17
|
+
# default: "YOUR_WIT_ACCESS_TOKEN",
|
18
|
+
# es: "YOUR_ES_WIT_ACCESS_TOKEN",
|
19
|
+
# fr: "YOUR_fr_WIT_ACCESS_TOKEN"
|
20
|
+
# }
|
21
|
+
# }
|
22
|
+
|
23
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
Kogno::Application.configure do |config|
|
2
|
+
|
3
|
+
config.messenger.graph_url = "https://graph.facebook.com/v2.6/me"
|
4
|
+
|
5
|
+
# You can run this chatbot in several Facebook Pages.
|
6
|
+
config.messenger.pages = {
|
7
|
+
"YOUR_FANPAGE_ID" => {
|
8
|
+
name: "YOUR_FANPAGE_NAME",
|
9
|
+
token: "YOUR_ACCESS_TOKEN"
|
10
|
+
},
|
11
|
+
# "YOUR_2ND_FANPAGE_ID" => {
|
12
|
+
# name: "YOUR_2ND_FANPAGE_NAME",
|
13
|
+
# token: "YOUR_2ND_ACCESS_TOKEN"
|
14
|
+
# }
|
15
|
+
}
|
16
|
+
|
17
|
+
config.messenger.webhook_route = "/webhook_messenger"
|
18
|
+
config.messenger.webhook_verify_token = "<YOUR_VERIFY_TOKEN>"
|
19
|
+
|
20
|
+
# Default context for any post comment arrived
|
21
|
+
config.routes.post_comment = :main
|
22
|
+
|
23
|
+
# Default context for incoming events about subscriptions to recurring notifications
|
24
|
+
config.routes.recurring_notification = :main
|
25
|
+
|
26
|
+
#Whitelisted Domains, update by running kogno messenger update_whitelisted_domains
|
27
|
+
config.messenger.whitelisted_domains = [
|
28
|
+
"kogno.io"
|
29
|
+
]
|
30
|
+
|
31
|
+
#Activate/deactivate by running kogno messenger menu on|off
|
32
|
+
config.messenger.persistent_menu = [
|
33
|
+
{
|
34
|
+
locale: :default,
|
35
|
+
composer_input_disabled: false,
|
36
|
+
call_to_actions: [
|
37
|
+
{
|
38
|
+
title: "Title",
|
39
|
+
type: :postback,
|
40
|
+
payload: "your_context/a_payload_in_the_context"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
title: "Title2",
|
44
|
+
type: :postback,
|
45
|
+
payload: "your_payload"
|
46
|
+
}
|
47
|
+
]
|
48
|
+
}
|
49
|
+
]
|
50
|
+
|
51
|
+
#Activate/deactivate by running kogno messenger get_started on|off
|
52
|
+
config.messenger.welcome_screen_payload = "GET_STARTED"
|
53
|
+
|
54
|
+
#Activate/deactivate by running kogno messenger greeting on|off
|
55
|
+
config.messenger.greeting = [
|
56
|
+
{
|
57
|
+
locale: :default,
|
58
|
+
text: "Hello word."
|
59
|
+
}
|
60
|
+
]
|
61
|
+
|
62
|
+
#Activate/deactivate by running kogno messenger ice_breakers on|off
|
63
|
+
config.messenger.ice_breakers = [
|
64
|
+
{
|
65
|
+
question: "Question 1?",
|
66
|
+
payload: "context/payload"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
question: "Question 2",
|
70
|
+
payload: "payload_two"
|
71
|
+
}
|
72
|
+
]
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Kogno::Application.configure do |config|
|
2
|
+
|
3
|
+
config.telegram.bot_name = "<Your Bot Name in Telegram>"
|
4
|
+
|
5
|
+
config.telegram.api_url = "https://api.telegram.org"
|
6
|
+
|
7
|
+
config.telegram.token = "<Your token here>"
|
8
|
+
|
9
|
+
# After configure the following three fiels you can run 'kogno telegram webhook on' in order to receive updates from Telegram
|
10
|
+
config.telegram.webhook_https_server = "https://yourdomain.com"
|
11
|
+
config.telegram.webhook_route = "/webhook_telegram"
|
12
|
+
config.telegram.webhook_drop_pending_updates = true # If true, every time you run 'kogno telegram webhook on' this will drop pending updates from Telegram.
|
13
|
+
|
14
|
+
|
15
|
+
# Default routes for special updates in Telegram
|
16
|
+
config.routes.inline_query = :main
|
17
|
+
config.routes.chat_activity = :main
|
18
|
+
|
19
|
+
#Commands
|
20
|
+
|
21
|
+
# You can create different commands for several scopes.
|
22
|
+
# Valid scopes: default, all_private_chats, all_group_chats and all_chat_administrators
|
23
|
+
# After configure this part, you can run 'kogno telegram set_commands default|all_private_chats|all_group_chats|all_chat_administrators|all'
|
24
|
+
config.telegram.commands = [
|
25
|
+
{
|
26
|
+
scope: :default,
|
27
|
+
commands:{
|
28
|
+
start: "Here, the command's description"
|
29
|
+
}
|
30
|
+
},
|
31
|
+
# {
|
32
|
+
# scope: :all_private_chats,
|
33
|
+
# commands:{
|
34
|
+
# start: "Here, the command's description",
|
35
|
+
# command2: "Here, the command's description"
|
36
|
+
# }
|
37
|
+
# }
|
38
|
+
]
|
39
|
+
|
40
|
+
# Route a command to a spesific context
|
41
|
+
config.routes.commands = {
|
42
|
+
start: :main
|
43
|
+
}
|
44
|
+
|
45
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Kogno::Application.configure do |config|
|
2
|
+
|
3
|
+
config.whatsapp.graph_url = "https://graph.facebook.com/v13.0/"
|
4
|
+
config.whatsapp.phone_number_id = "<YOUR WHATSAPP PHONE NUMBER ID>"
|
5
|
+
|
6
|
+
config.whatsapp.access_token = "YOUR_ACCESS_TOKEN"
|
7
|
+
|
8
|
+
#Webhook
|
9
|
+
config.whatsapp.webhook_route = "/webhook_whatsapp"
|
10
|
+
config.whatsapp.webhook_verify_token = "<YOUR_VERIFY_TOKEN>"
|
11
|
+
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# get "/get_user_name" do
|
2
|
+
# @user = User.find(params[:user_id])
|
3
|
+
# "<h1>#{@user.first_name}</h1>"
|
4
|
+
# end
|
5
|
+
#
|
6
|
+
# post "/test" do
|
7
|
+
# params = JSON.parse(request.body.read, {:symbolize_names => true})
|
8
|
+
# "This is a GET post, here your params"
|
9
|
+
# params.to_json
|
10
|
+
# end
|
metadata
ADDED
@@ -0,0 +1,220 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kogno
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martín Acuña Lledó
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-06-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 6.1.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 6.1.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: actionview
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 6.1.5
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 6.1.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.2.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.2.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sinatra-contrib
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tilt
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.10
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.10
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sinatra-cross_origin
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.4.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.4.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: wit
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 6.0.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 6.0.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: fileutils
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Framework for chatbots, what Ruby on Rails is for webapps.
|
126
|
+
email: macuna@gmail.com
|
127
|
+
executables:
|
128
|
+
- kogno
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- bin/kogno
|
133
|
+
- lib/boot.rb
|
134
|
+
- lib/core/bin_helpers/messenger_ctl.rb
|
135
|
+
- lib/core/bin_helpers/scaffolding.rb
|
136
|
+
- lib/core/bin_helpers/scheduled_messages_ctl.rb
|
137
|
+
- lib/core/bin_helpers/sequences_ctl.rb
|
138
|
+
- lib/core/bin_helpers/server_ctl.rb
|
139
|
+
- lib/core/bin_helpers/telegram_ctl.rb
|
140
|
+
- lib/core/bin_helpers/webhook_ctl.rb
|
141
|
+
- lib/core/db.rb
|
142
|
+
- lib/core/extensions/array.rb
|
143
|
+
- lib/core/extensions/hash.rb
|
144
|
+
- lib/core/extensions/logger.rb
|
145
|
+
- lib/core/extensions/string.rb
|
146
|
+
- lib/core/extensions/wit.rb
|
147
|
+
- lib/core/global_methods.rb
|
148
|
+
- lib/core/helpers/string.rb
|
149
|
+
- lib/core/lib/base_config.rb
|
150
|
+
- lib/core/lib/block_params.rb
|
151
|
+
- lib/core/lib/context.rb
|
152
|
+
- lib/core/lib/error_handler.rb
|
153
|
+
- lib/core/lib/message.rb
|
154
|
+
- lib/core/lib/messenger/api.rb
|
155
|
+
- lib/core/lib/messenger/facebook_graph.rb
|
156
|
+
- lib/core/lib/messenger/message.rb
|
157
|
+
- lib/core/lib/messenger/notification.rb
|
158
|
+
- lib/core/lib/messenger/post_comment.rb
|
159
|
+
- lib/core/lib/messenger/recurring_notification.rb
|
160
|
+
- lib/core/lib/nlp.rb
|
161
|
+
- lib/core/lib/notification.rb
|
162
|
+
- lib/core/lib/spelling.rb
|
163
|
+
- lib/core/lib/telegram/api.rb
|
164
|
+
- lib/core/lib/telegram/chat_activity.rb
|
165
|
+
- lib/core/lib/telegram/inline_query.rb
|
166
|
+
- lib/core/lib/telegram/message.rb
|
167
|
+
- lib/core/lib/telegram/notification.rb
|
168
|
+
- lib/core/lib/whatsapp/api.rb
|
169
|
+
- lib/core/lib/whatsapp/message.rb
|
170
|
+
- lib/core/lib/whatsapp/notification.rb
|
171
|
+
- lib/core/lib/whatsapp/status_message.rb
|
172
|
+
- lib/core/loaders/config_files.rb
|
173
|
+
- lib/core/models/chat_log.rb
|
174
|
+
- lib/core/models/long_payload.rb
|
175
|
+
- lib/core/models/matched_message.rb
|
176
|
+
- lib/core/models/messenger_recurring_notification.rb
|
177
|
+
- lib/core/models/scheduled_message.rb
|
178
|
+
- lib/core/models/sequence.rb
|
179
|
+
- lib/core/models/telegram_chat_group.rb
|
180
|
+
- lib/core/models/user.rb
|
181
|
+
- lib/core/web/webhook.rb
|
182
|
+
- lib/kogno.rb
|
183
|
+
- scaffolding/new_project/Gemfile
|
184
|
+
- scaffolding/new_project/application.rb
|
185
|
+
- scaffolding/new_project/bot/contexts/main_context.rb
|
186
|
+
- scaffolding/new_project/bot/conversation.rb
|
187
|
+
- scaffolding/new_project/bot/models/user.rb
|
188
|
+
- scaffolding/new_project/config/application.rb
|
189
|
+
- scaffolding/new_project/config/database.yml
|
190
|
+
- scaffolding/new_project/config/locales/en.yml
|
191
|
+
- scaffolding/new_project/config/locales/es.yml
|
192
|
+
- scaffolding/new_project/config/nlp.rb
|
193
|
+
- scaffolding/new_project/config/platforms/messenger.rb
|
194
|
+
- scaffolding/new_project/config/platforms/telegram.rb
|
195
|
+
- scaffolding/new_project/config/platforms/whatsapp.rb
|
196
|
+
- scaffolding/new_project/web/routes.rb
|
197
|
+
homepage: https://rubygems.org/gems/kogno
|
198
|
+
licenses:
|
199
|
+
- MIT
|
200
|
+
metadata: {}
|
201
|
+
post_install_message:
|
202
|
+
rdoc_options: []
|
203
|
+
require_paths:
|
204
|
+
- lib
|
205
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: 2.7.0
|
210
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: 1.8.11
|
215
|
+
requirements: []
|
216
|
+
rubygems_version: 3.1.2
|
217
|
+
signing_key:
|
218
|
+
specification_version: 4
|
219
|
+
summary: Kogno!
|
220
|
+
test_files: []
|