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

Slack and API.AI Modules - Error: Channel id format is not valid #18

Open
jsalwen opened this issue Dec 1, 2017 · 2 comments
Open

Slack and API.AI Modules - Error: Channel id format is not valid #18

jsalwen opened this issue Dec 1, 2017 · 2 comments

Comments

@jsalwen
Copy link
Contributor

jsalwen commented Dec 1, 2017

I created a new bot using the Slack and API.AI modules. API.AI module is in Fulfillment mode.

The following error is returned when the bot tries to send the response to the user in Slack:

Error: Channel id format is not valid (actual: undefined, required: string)
    at Slack.validateChannelId (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\slack.js:40:13)
    at Slack.validateBeforeSending (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\slack.js:66:10)
    at Slack.sendText (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\slack.js:71:10)
    at Object.handleText [as text] (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\outgoing.js:23:43)
    at outgoingMiddleware (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\index.js:23:3)
    at exec (c:\projects\my-bot\node_modules\mware\index.js:50:23)
    at Function.run (c:\projects\my-bot\node_modules\mware\index.js:63:7)
    at Object.dispatch (c:\projects\my-bot\node_modules\botpress\lib\webpack:\src\middlewares.js:45:10)
    at Object.sendOutgoing (c:\projects\my-bot\node_modules\botpress\lib\webpack:\src\middlewares.js:159:29)
    at c:\projects\my-bot\node_modules\botpress-api.ai\bin\webpack:\src\index.js:55:43
    at process._tickCallback (internal/process/next_tick.js:109:7)
15:04:29 - warn: botpress-api.ai API Error. Could not process incoming text: Channel id format is not valid (actual: undefined, required: string)

This is because the botpress-slack is excepting a value for raw.channelId when event.bp.middlewares.sendOutgoing is called.

@jsalwen
Copy link
Contributor Author

jsalwen commented Dec 1, 2017

@slvnperron I can create a PR for this.

This can be fixed by adding channelId and options: {} to raw

event.bp.middlewares.sendOutgoing({
type: 'text',
platform: event.platform,
text: result.fulfillment.speech,
raw: {
to: event.user.id,
message: result.fulfillment.speech
}
})

Do you see any problem with this approach?

jsalwen added a commit to smalltalk-ai/botpress-api.ai that referenced this issue Dec 1, 2017
* add `raw.channelId` and `raw.options` to data when calling `sendOutgoing`
slvnperron added a commit that referenced this issue Dec 2, 2017
@slvnperron
Copy link
Member

@jsalwen I think that's reasonable. Ideally we would make it as channel-independent as possible but I guess sometimes it's hard to avoid.

Perhaps check copying channelId if provided would be better (i.e. no platform checking)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants