Giter VIP home page Giter VIP logo

botbuilder-wechat-connector's People

Contributors

bnookala avatar jyfcrw avatar lijiarui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

botbuilder-wechat-connector's Issues

Unable to send message

Hi @jyfcrw ,
I have been trying to get your example working and while the auth step and parsing of incoming message works brilliantly, when it comes to sending reply back, I always get

Error { WeChatAPIError: invalid appid hint: []
    at C:\Projects\collins\test\botbuilder-wechat-connector\node_modules\wechat-api\lib\util.js:15:13
    at done (C:\Projects\collins\test\botbuilder-wechat-connector\node_modules\urllib\lib\urllib.js:441:5)
    at C:\Projects\collins\test\botbuilder-wechat-connector\node_modules\urllib\lib\urllib.js:676:9
    at decodeContent (C:\Projects\collins\test\botbuilder-wechat-connector\node_modules\urllib\lib\urllib.js:514:14)
    at IncomingMessage.<anonymous> (C:\Projects\collins\test\botbuilder-wechat-connector\node_modules\urllib\lib\urllib.js:641:7)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19) name: 'WeChatAPIError', code: 40013 }

I have looked at the request url being used and the &appid= &secret= are correct and am uncertain what step I am missing.
The documentation here seems to be the cause of issue as going to the url there that is generated internally as well yields the error above. Due to limited understanding through Google Translate of Sandbox page, I imagine there is some step I am missing ?

Cannot read property 'getSignature' of undefined

Hi ,

i got this error when the server receiving messages using the tests/example.js. Please help.

events.js:160
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read property 'getSignature' of undefined
    at /home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/wechat/lib/wechat.js:450:34
    at Parser.<anonymous> (/home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/xml2js/lib/xml2js.js:483:18)
    at emitOne (events.js:96:13)
    at Parser.emit (events.js:188:7)
    at Object.onclosetag (/home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/xml2js/lib/xml2js.js:444:26)
    at emit (/home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/sax/lib/sax.js:640:35)
    at emitNode (/home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/sax/lib/sax.js:645:5)
    at closeTag (/home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/sax/lib/sax.js:905:7)
    at Object.write (/home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/sax/lib/sax.js:1449:13)
    at Parser.exports.Parser.Parser.parseString (/home/ubuntu/wechat/ms/bot/node_modules/botbuilder-wechat-connector/node_modules/xml2js/lib/xml2js.js:502:31)

Add Audio Recognition for connector

Hi, thanks for the great repo.

As wechatOA can do STT automatically, so I suggest to add recognition function, it means connector can convert audio to speech automatically if the audio response has the Recognition field.

When I say audio 你好哈喽!, wechat audio response log as follows:

{
    "ToUserName": "gh_87e03c422b73", 
    "FromUserName": "o04vx0YXJGTnPdiXLSu1xZW2Ajuo", 
    "CreateTime": "1513529079", 
    "MsgType": "voice", 
    "MediaId": "9seTBfhw1KmTiaORRo4dPXwULfy4DQnyjcnPPJjjT9gwoqU2WXRTEqfwxV2pRQbZ", 
    "Format": "amr", 
    "MsgId": "6500557895850000384", 
    "Recognition": "你好哈喽!"
}

I found your code

if (msgType == 'text') {
  msg = msg.text(wechatMessage.Content);
} else {
  msg = msg.text('');
}

I suggest to add msgType === 'voice' like this

if (msgType == 'text') {
  msg = msg.text(wechatMessage.Content);
} else if (msgType == 'voice') {
  msg = msg.text(wechatMessage.Recognition);
} else{
  msg = msg.text('');
}

Do you have any suggestion to do this? Or if you give some suggestion, I'd like to pull request.

Sending multiple responses in a row - they will arrive in a random order

Let's say I want to send multiple responses to the user:

session.send('test 1');
session.send('test 2');
session.send('test 3');

These messages arrive in a random order, which is not expected.

If I add a small delay between the three messages, e.g. 250ms, then the user only receives one of the three messages, and the other two fail because apparently the token or conversation expires somehow.

How to test the wechat bot?

by default, if we just build default ms bot; we could use emulator to test it;
for wechat bot, how to test it? much thanks! the best way is that: add the test official account, and send the message to the account, the wechat bot could response these message.

Much thanks in advance.

deploy and test

Hello,
so using test account I can fully test wechat with MS bot framework?
do you know c# implementation of the same?

TypeError: Cannot read property 'expires_in' of null

Receiving messages works fine but sending messages breaks with this error
node_modules/wechat-api/lib/api_common.js:179:48

It seems the data return from the getAccessToken() is null i don't understand why.

I think wechat-api try to initialize with a getAccessToken failing

'getSignature' undefined

When i received msg from wechat my server crash like this

events.js:160
throw er; // Unhandled 'error' event
^

TypeError: Cannot read property 'getSignature' of undefined
at ......\node_modules\wechat\lib\wechat.js:450:34

What I'm missing?

Hi I had setup a WeChat Public trial account, and in bot framework here's my NodeJS code:

`var express = require('express');
var builder = require('botbuilder');
var botbuilder_azure = require("botbuilder-azure");
var WC_Connector = require('botbuilder-wechat-connector');

// Setup Express Server
var server = express();
server.listen(process.env.port || process.env.PORT || 3978, function () {
console.log('%s listening to %s', server.name, server.url);
});

// Create chat connector for communicating with the Bot Framework Service

var connector = new WC_Connector.WechatConnector({
appID: process.env.WeChatAppId || "",
appSecret: process.env.WeChatAppSecret || "",
appToken: process.env.WeChatAppToken || ""
});

server.post('/api/messages', connector.listen());

var bot = new builder.UniversalBot(connector, function (session, args) {
session.send('You reached the default message handler. You said '%s'.', session.message.text);
});`

However when I tried to send a message from wechat, it shows that:
This Offical Account is temporarily unavailable. Try again later.

Is that anything for my configuration error about wechat?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.