You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+19-12
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ WeChat gem trying to helping Rails developer to integrated [enterprise account](
17
17
18
18
`wechat` command share the same API in console, so you can interactive with wechat server quickly, without starting up web environment/code.
19
19
20
-
A responder DSL can used in Rails controller, so giving a event based interface to handler message sent by end user from wechat server.
20
+
A responder DSL can used in Rails controller, so giving a event based interface to handler message sent by end user from wechat server.
21
21
22
22
Wechat provide OAuth2.0 as authentication service and possible to intergrated with devise/other authorization gems, [omniauth-wechat-oauth2](https://github.com/skinnyworm/omniauth-wechat-oauth2) is a good start
23
23
@@ -88,16 +88,16 @@ default: &default
88
88
token: "app_token"
89
89
access_token: "/var/tmp/wechat_access_token"
90
90
91
-
production:
91
+
production:
92
92
appid: <%= ENV['WECHAT_APPID'] %>
93
93
secret: <%= ENV['WECHAT_APP_SECRET'] %>
94
94
token: <%= ENV['WECHAT_TOKEN'] %>
95
95
access_token: <%= ENV['WECHAT_ACCESS_TOKEN'] %>
96
96
97
-
development:
97
+
development:
98
98
<<: *default
99
99
100
-
test:
100
+
test:
101
101
<<: *default
102
102
```
103
103
@@ -161,11 +161,11 @@ Rare case, you may want to hosting more than one wechat enterprise/public accoun
JS-SDK enable you control wechat behavior in your web page, but need inject a config with signature methods first, you can obtain those signature hash via below
@@ -182,7 +182,7 @@ wechat gems won't handle any privilege exception. (except token time out, but it
182
182
183
183
The available API is different between public account and enterprise account, so wechat gems provide different set of command.
184
184
185
-
Feel safe if you can not read Chinese in the comments, it's keep there in order to copy & find in official document more easier.
185
+
Feel safe if you can not read Chinese in the comments, it's keep there in order to copy & find in official document more easier.
@@ -535,10 +535,17 @@ class WechatsController < ActionController::Base
535
535
536
536
# Any not match above will fail to below
537
537
on :fallback, respond:'fallback message'
538
+
539
+
# If you need do something after response, you should add after_wechat_response(req, res)
540
+
# private
541
+
#
542
+
# def after_wechat_response(req, res)
543
+
# WechatLog.create req: req, res: res
544
+
# end
538
545
end
539
546
```
540
547
541
-
So the importent statement is only `wechat_responder`, all other is just a DSL:
548
+
So the importent statement is only `wechat_responder`, all other is just a DSL:
542
549
543
550
```
544
551
on <message_type> do |message|
@@ -571,13 +578,13 @@ class WechatsController < ActionController::Base
571
578
# When no other responder can handle incoming message, will transfer to human customer service.
572
579
on :fallbackdo |message|
573
580
message.reply.transfer_customer_service
574
-
end
581
+
end
575
582
end
576
583
```
577
584
578
585
Caution: do not setting default text responder if you want to using [multiply human customer service](http://dkf.qq.com/), other will lead text message can not transfer.
579
586
580
-
587
+
581
588
## Known Issue
582
589
583
590
* Sometime, enterprise account can not receive the menu message due to Tencent server can not resolved the DNS, so using IP as a callback URL more stable, but it's never happen for user sent text message.
0 commit comments