Giter Site home page Giter Site logo

smooch-bot-example's Issues

Get message from slack/frontApp and do some processing!

Hi there!

Sorry for the bad title, Let me explain.

First thing to tell you is We have configured Slack as my Receiving channel (business end, Later we will configure the frontApp and many others).

We are developing our contact-us (live chat/ Support) page. We want both the Bot and Human agent can answer our customer's queries. Human should answer the queries which a bot is unable to understand. We have done this already by using the bot.setProp('silent', true). Whenever our customer asks a query, we first check it either it can be handled by our bot (with certain AI) or not. IFF yes then bot will simply answer the query. IFF not we redirect our customer to our live human agent by simply setting the bot.setProp('silent', true).

Now here comes the climax. Now bot is Turned OFF and our Human Agent (on Slack) is chatting with our customer live. Now If customer asks an query which can be handled by our bot, Is there any way that our Human Agent (on slack) can turn the bot ON by simply setting bot.setProp('silent', false).

QUESTION IN SHORT:
Is there any way to process the messages from Slack/FrontApp (or any business end). So that we can turn the Bot ON.

Bot states inconsistent with multiple user messages.

Whenever the user messages multiple lines quickly the bot behaves unpredictably by either restarting the current state, skipping the next designated state, or sometimes partially executing a state in attempts to read in the user's stream of messages.

This happens even for our simple start state where the bot waits for the user to say something and responds 'Hello' and moves onto the next, different state. If the user says 'hi' four times in four separate lines quickly, the bot responds by saying 'Hello' four times (sometimes even giving the processing 'beep boop' message) instead of just say 'Hello' once and treating the next user message line as input for the next state.

This seems like a significant issues. Is there anyway to ensure that a state executes to its entirety before it attempts to read in another user message?

smooch-bot not replying

Hi,
I tried setting up smooch-bot via the Heroku example. I open the heroku app and chat with the bot, but I don't receive any replies. The messages I type are being forwarded to smooch because I am receiving email notifications...but no replies from smooch-bot in the chat window.

I am not a programmer and try to follow the directions. I am deploying the app via dropbox connection. Is it normal that the Heroku folder in my dropbox is empty? I tried to uploading script.js into Dropbox>Apps>Heroku and Dropbox>Apps>Heroku>mybot...but no replies. I am not sure where I went wrong, could you help me point in the right direction?

Thank you for your help in advance!

Smooch Webhook - Bad Request

After 2016-10-21, I am not being able to create new webhooks and obtaining the following error running heroku web local:

2:52:17 PM web.1 |  > [email protected] start smooch-bot-example
2:52:17 PM web.1 |  > node heroku
2:52:19 PM web.1 |  Smooch Bot listening at http://:::5000
2:52:20 PM web.1 |  Error creating Smooch webhook: { Error: Bad Request
2:52:20 PM web.1 |      at handleStatus (/smooch-bot-example/node_modules/smooch-core/lib/utils/http.js:45:17)
2:52:20 PM web.1 |      at process._tickCallback (internal/process/next_tick.js:103:7)
2:52:20 PM web.1 |    response: 
2:52:20 PM web.1 |     Body {
2:52:20 PM web.1 |       url: 'https://api.smooch.io/v1/webhooks',
2:52:20 PM web.1 |       status: 400,
2:52:20 PM web.1 |       statusText: 'Bad Request',
2:52:20 PM web.1 |       headers: Headers { _headers: [Object] },
2:52:20 PM web.1 |       ok: false,
2:52:20 PM web.1 |       body: 
2:52:20 PM web.1 |        PassThrough {
2:52:20 PM web.1 |          _readableState: [Object],
2:52:20 PM web.1 |          readable: true,
2:52:20 PM web.1 |          domain: null,
2:52:20 PM web.1 |          _events: [Object],
2:52:20 PM web.1 |          _eventsCount: 1,
2:52:20 PM web.1 |          _maxListeners: undefined,
2:52:20 PM web.1 |          _writableState: [Object],
2:52:20 PM web.1 |          writable: false,
2:52:20 PM web.1 |          allowHalfOpen: true,
2:52:20 PM web.1 |          _transformState: [Object] },
2:52:20 PM web.1 |       bodyUsed: false,
2:52:20 PM web.1 |       size: 0,
2:52:20 PM web.1 |       timeout: 0,
2:52:20 PM web.1 |       _raw: [],
2:52:20 PM web.1 |       _abort: false } }
2:52:20 PM web.1 |  Error: Bad Request
2:52:20 PM web.1 |      at handleStatus (/smooch-bot-example/node_modules/smooch-core/lib/utils/http.js:45:17)
2:52:20 PM web.1 |      at process._tickCallback (internal/process/next_tick.js:103:7)

However, using the bearer token created by the application, I successfully create a webhook using curl (as described at Smooch documentation).

curl https://api.smooch.io/v1/webhooks \
     -X POST \
     -d '{"target": "http://example.com/callback"}' \
     -H 'content-type: application/json' \
     -H 'authorization: Bearer your-jwt'

how to move bot receive step in script.js

How to send bot another state's receive step in script.js file.

I can do this in heroku/index.js page using the following code.

for going receive I have to do it like

 Promise.all([
            stateMachine.bot.releaseLock(),
            stateMachine.setState(ai_action),   // set new state
            stateMachine.receive(ai_action)      // goto receive
        ]);

I need to do this same in script.js

Restarting the bot conversation

I cloned this repo and am building a bot which is running in a web embedded widget. Since I'm in development mode, I need a way to explicitly call start in the script.js as a way to "restart" my bot script when I add or change functionality.

Is there a way I can control calling the start prompt method programmatically?

start: {
    prompt: (bot) => {
        return bot.say(`Hey, I'm a robot! Just going to ask you a few questions before you get started...`)
            .then(bot.say(`First up: what's your full name?`))
    },
    receive: function (bot, message) {
        const name = message.text;
        const firstName = name.split(' ').slice(0, -1).join(' ');
        return bot.setProp('name', name)
            .then(() => bot.say(`Nice to meet you ${firstName}!`))
            .then(() => 'getRole');
    }
},

Question: Customization and typing indicator

Not so much an issue, more a question on how to use smooch bot to recreate your Smooch conversational onboarding experience (which I love!).

Your onboarding UI is full screen and starts immediately with a question. Then before each reply from your bot a typing indicator is shown. Can all this (full screen, let the bot initiate the conversation and show a typing indicator) be achieved with this framework?

Any help or pointers would be greatly appreciated! In any case this is awesome stuff!

Reply button in web embedded widget opens new browser tab on click

I'm outputting a "Reply Button" to the conversation using the following code:

getRole: {
    prompt: (bot) => bot.say(`What's your primary role at your company? %[Agent](reply:agent) %[Team Manager](reply:team) %[Broker](reply:broker)`),
    receive: (bot, message) => {
        return bot.setProp('role', message.text)
            .then(() => bot.say(`Thanks!`))
            .then(() => 'getBusinessType');
    }
},

When one of the Reply buttons is clicked a new browser tab opens instead of the reply value being added to the conversation. After inspecting the DOM I noticed the Reply buttons are actually being output as anchors with target="_blank".

Deploy to AWS Lambda

Hi,

Would this bot work on a serverless architecture such as AWS Lambda?

Thanks

bot.SetProp() inconsistently works

Whenever I use bot.setProp in my Script, it inconsistently saves the properties I use. It is necessary to retain certain values in the Smooch Store for my bot, but it is also essential that I clear them out after I use them. When I try to clear them with bot.setProp('property', ""), it only clears out certain properties while other retain their value.

Passing a param from heroku/index.js to a certain state in script.js

Hi there.

I wanna know how can I pass a param/argument from heroku/index.js to a certain state in script.js

I have done like below

heroku.index

Promise.all([
        stateMachine.bot.releaseLock(),
        stateMachine.setState(ai_action), // set new state ADD_MOVIE
        stateMachine.receiveMessage(params.movie_keywords) // calling receive of ADD_MOVIE state and passing a string param i.e params.movie_keywords = "my_string"
    ]);
    res.end();

and in script.js I have defined an state named ADD_MOVIE here is the code

ADD_MOVIE : {
        receive: (bot, message) => {
            const movie_name_searched = message.text;
            console.log("movie_name_searched : "+ movie_name_searched);  // I am getting undefined here
        }
    }

QUESTION

What I am missing here. Am I doing any thing wrong here. please help. I wanna pass the param value from heroku/index.js to my ADD_MOVIE recieve state in script.js.

Cannot send message to our customer when customer did not write first. :(

let say we have a customer using our iOS app (smooch iOS SDK is integrated) but he/she didn't sent a message via smooch chat widget (or via any other messaging channel). is there any way to know that new customer has started using our app, so that we can start conversation with them by sending her a message saying greetings

basically the question is How to send a message (smooch) to our customer initiated by us via slack and/or front?

Fred said this on Smooch support
Hi there! Starting a conversation with a user will only work with whispers. We don’t offer a way to start conversation through business systems since it would require we create channels for every init in your app (it would be too heavy for you to handle)

But

Whispers will initiate the chat with the customer once he/she send us reply. If he/she didn't replied back we can't init the chat with our customer. And that's why whispers will fail in this situation too.

We do need a way to start conversation with our customers through business systems anyhow. we can handle all that heavy stuff.
Please give any suggestion/direction or any hack to to this. Thanks

Can we do this something like using slack api? like what happens when a new user send us a message? A new channel is created and a user joins that channel. right?

I have successfully created a channel in slack via slack api. here is the code.

https://www.dropbox.com/s/r27fd6t8pii2qip/Screenshot%202017-03-27%2013.54.54.png?dl=0

UI for creating conversation?

Hello. I am able to use the chatbot. Now, I need to setup the conversation, and I find doing it by code a bit counterproductive. Is there an easier way to do this? like here EstherBot

smooch Bot /help menu implementation

Can we implement bot /help menu in using smooch

See image below for example in telegram
telegram chat

Is this possible? Please suggest me any pointers and directions for this.

How this work?
User typed "/" bot will show the available help menu as a autocomplete menu

Uncaught (in promise) Error at o (shallowEqual.js:18)

Smooch web widget not loading.
I am getting this when inspecting element.

image

Failed to load resource: the server responded with a status of 401 ()
shallowEqual.js:18 Uncaught (in promise) Error
    at o (shallowEqual.js:18)

Any feeback please.

how to get last bot state

Hello,

Is there any way to get the last state executed by the bot. Like

let say I have states defined for my bot are given below.

ASK_NAME:
ASK_EMAIL:
ASK_ADDRESS:

ASK_NAME executed successfully then bot is on ASK_EMAIL state, Can I get the last executed state was ASK_NAME, is there any way to get this?

Regards
Qadir Hussain

App crash on PROD heroku

Hi there,

I have created two separate smooch apps. names as. qBotStaging , qBotLive.
qBotStaging is configured with my Heroku-staging and qBotLive is configured with my Heroku-live.
both of my heroku (i.e Heroku-staging & Heroku-live) has the same code . App is working fine on Heroku-staging but its crashing on Heroku-live.

Here is the log

2017-01-12T07:32:25.285191+00:00 app[web.1]: trigger : message:appUser
2017-01-12T07:32:25.285294+00:00 app[web.1]: case message:appUser
2017-01-12T07:32:25.285350+00:00 app[web.1]: user message: {Hi there}
2017-01-12T07:32:25.649184+00:00 app[web.1]: Caught! Bad Request
2017-01-12T07:32:27.622990+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/webhook" host=qjamesbot.herokuapp.com request_id=aa815dce-6000-4ee2-a5e8-18b0e2ee5533 fwd="54.91.11.7" dyno=web.1 connect=0ms service=30001ms status=503 bytes=0

log of statging => Catch not executed even silent property is undefined.

2017-01-12T07:28:21.851935+00:00 app[web.1]: trigger : message:appUser
2017-01-12T07:28:21.851959+00:00 app[web.1]: case message:appUser
2017-01-12T07:28:21.852087+00:00 app[web.1]: user message: {hi}
2017-01-12T07:28:22.268759+00:00 app[web.1]: isBotSilent : undefined
2017-01-12T07:28:37.198704+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/webhook" host=qjamesbot-staging.herokuapp.com request_id=a3a6b1b6-d55c-4339-804b-bcc4afb048ab fwd="54.91.11.7" dyno=web.1 connect=0ms service=30003ms status=503 bytes=0

Here is my code of heroku/index.js where it crashed

//Check bot isBotSilent
    stateMachine.bot.getProp('silent')
    .then((isBotSilent) => {
        console.log("isBotSilent : "+isBotSilent); // In staging this log prints but on live heroku its not and catch is executed
    }).catch(function(error) {
        console.log('Caught!', error.message);
    });

Please help. ASAP, its 3rd day I m stuck on this.

Question

More of a question than an issue. When you create an action button like

%[Button Text](postback:button action)

How do you specify the handler for the postback. What does "button action" map to? Can you show an example?

[REQUEST]

Please you could add, structured messages and carousel messages.

Changing Script

Hi!

I'm running the heroku app locally and I altered the wording of the script. However, the changes do not appear in the conversation I have with the bot, regardless of whether i restart it or not. Could it be that the app is somehow pulling the original script from an api externally because even if I comment out the whole script it continues to have the same convo flow.

Look forward to hearing from one of you.

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.