howdyai / botkit

Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.
MIT License
11.45k stars 2.28k forks source link

convo.ask not receiving the callback on replies- Ciscospark #961

Closed rajmohan1955 closed 7 years ago

rajmohan1955 commented 7 years ago

Hi Guys, I have created a room on cisco spark and I am trying to initiate a conversation in that room. I am able to ask the question in the room but I am not receiving the control in the callback when someone replies.

bot.startConversation({
user: TestRoomId,
channel: TestRoomId,
text: 'dummy'}, 
function(err, convo) {
         convo.ask({
         channel: TestRoomId,
         text: 'What are you doing?',
         pattern:'yes'}, 
         function(res, convo) {
                   convo.say(res.text + ' is not a good enough answer.')
                   convo.next()
                   }) })
jonchurch commented 7 years ago

User needs to be a user id. Conversations are carried out 1 to 1 and therefore will ignore any messages sent by users other than the one you initially start the convo with.

This might work as a DM convo, channel and user are probably the same there idk

Spark is unique in that for some events, like bot_channel_join, the user field passed on the payload is the subject, not the actor, of an action.

IE bot_join has user: <BOT_IDENTITY> with an actor_id: <ACTING_USER> On Thu, Aug 17, 2017 at 1:49 PM rajmohan1955 notifications@github.com wrote:

Hi Guys, I have created a room on cisco spark and I am trying to initiate a conversation in that room. I am able to ask the question in the room but I am not receiving the control in the callback when someone replies.

bot.startConversation({ user: TestRoomId, channel: TestRoomId, text: 'dummy'}, function(err, convo) { convo.ask({ channel: TestRoomId, text: 'What are you doing?', pattern:'yes'}, function(res, convo) { convo.say(res.text + ' is not a good enough answer.') convo.next() }) })

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/howdyai/botkit/issues/961, or mute the thread https://github.com/notifications/unsubscribe-auth/AMUR2zAIheWN7mwGTR4YtSNcfz6W1hylks5sZH0NgaJpZM4O6mCz .

rajmohan1955 commented 7 years ago

@jonchurch what I am trying to do is, I want the bot to post a question on the cisco spark room based on some logic. Then basis the answer in the room I want to take necessary action. What is the way to make this happen.

benbrown commented 7 years ago

You should pass the text only into convo.ask. Those extra options may be confusing Botkit.

Also, make sure you @mention your bot every time - in Spark, bots can only hear direct mentions.