Giter Club home page Giter Club logo

claudia-bot-builder's People

Contributors

alejandrogr avatar animsaj avatar datrio avatar gojko avatar guillemsalas avatar hnoesekabel avatar ivanjov avatar jmosbech avatar jonjamz avatar jonymusky avatar jveres avatar lnmunhoz avatar marcusoftnet avatar mohitdhanjani avatar n7best avatar nbransby avatar niponchi avatar otemnov avatar philnash avatar raymondborkowski avatar rping avatar sagech avatar samcorcos avatar silverfox70 avatar simalexan avatar srdjanprpa avatar stanwilsonjr avatar stojanovic avatar yipcma avatar zippeurfou 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  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  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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

claudia-bot-builder's Issues

line replyToken invalid

{ headers:
   { server: 'nginx',
     'content-type': 'application/json;charset=UTF-8',
     'x-line-request-id': '784ef36e-e864-4884-a8b5-fc883e7142fd',
     'x-content-type-options': 'nosniff',
     'x-xss-protection': '1; mode=block',
     'x-frame-options': 'DENY',
     'content-length': '94',
     expires: 'Mon, 13 Feb 2017 09:46:47 GMT',
     'cache-control': 'max-age=0, no-cache, no-store',
     pragma: 'no-cache',
     date: 'Mon, 13 Feb 2017 09:46:47 GMT',
     connection: 'close' },
  body: '{"message":"The property, \'replyToken\', in the request body is invalid (line: 1, column: 15)"}',
  statusCode: 400,
  statusMessage: 'Bad Request' }

Cannot add 'default_action' to Facebook generic template

I would like to add default_action to Facebook generic template, like the code below.

    const generic = new fbTemplate.Generic();

    return generic
      .addBubble('Claudia.js', 'Deploy Node.js microservices to AWS easily')
        .addUrl('https://claudiajs.com')
        .addImage('https://claudiajs.com/assets/claudiajs.png')
        .addDefaultAction('https://github.com/claudiajs/claudia-bot-builder')
        .addButton('Say hello', 'HELLO')
        .addButton('Go to Github', 'https://github.com/claudiajs/claudia')
      .get()

  • Expected behaviour:
    Able to add default_action into generic template
    https://developers.facebook.com/docs/messenger-platform/send-messages/template/generic
  • What actually happens:
    There is no addDefaultAction method to add the action.
  • Which bot engine (facebook, skype...):
    Facebook Messenger
  • Link to a minimal, executable project that demonstrates the problem:
    NA
  • Steps to install the project:
    NA
  • Steps to reproduce the problem:
    try the above snippet.

Thread Settings Reference

Hi,
I was trying to set a Welcome Message to my Bot. From the FB documentation it is stated that I should send a POST to https://graph.facebook.com/v2.6/**me/thread_settings**.

From what I can see looking through your code you only enable to the send POST to : https://graph.facebook.com/v2.6/**me/messages**.

Is there a way to send POST to 'me/thread_settings' with the current state of the code?

https://developers.facebook.com/docs/messenger-platform/thread-settings/greeting-text

Thank you.

Hello World Chat Bot Example On Site Not Working

Hello, I went through these steps here (Hello World Chat Bot) after going through installing and configuring claudia.

The example simply skips to the deployment step running claudia create --region us-east-1 --api-module bot. All that happens is the following error: Lambda handler is missing. please specify with --handler.

This is literally following the steps in your Hello World, so I'm rather perplexed. Is your documentation wrong? Is the example incomplete? Any assistance is appreciated, I really want to incorporate ClaudiaJS in a few client projects but this feels like a concerning start.

Node: v4.7.2
NPM: v4.1.2
Claudia: v2.6.0

Documentation around creating test JSON

I'm kind of new to API gateway, but I am having trouble running

claudia test-lambda --event ./my-test.json

{
  "context": {
    "method": "POST",
    "path": "/slack/slash-command",
    "sourceIp": "test-invoke-source-ip",
    "accountId": "00000000000000",
    "apiKey": "test-invoke-api-key",
    "authorizerPrincipalId": "",
    "caller": "00000000000000",
    "cognitoAuthenticationProvider": "",
    "cognitoAuthenticationType": "",
    "cognitoIdentityId": "",
    "cognitoIdentityPoolId": "",
    "stage": "test-invoke-stage",
    "user": "00000000000000",
    "userAgent": "Apache-HttpClient/4.3.4 (java 1.5)",
    "userArn": "arn:aws:iam::00000000000000:root"
  },
  "v": "2",
  "body": {
    "text": "goonies"
  },
  "headers": {
    "token": "zeJd9jNdslwd933jfnosd0a"
  },
  "queryString": {},
  "env": {
    "lambdaVersion": "latest"
  },
  "pathParams": {}
}

Output:

{
  "StatusCode": 200,
  "FunctionError": "Handled",
  "Payload": "{\"errorMessage\":\"Cannot read property 'token' of undefined\",\"errorType\":\"TypeError\",\"stackTrace\":[\"/var/task/node_modules/claudia-bot-builder/lib/slack/setup.js:14:21\",\"ApiBuilder.self.router (/var/task/node_modules/claudia-bot-builder/node_modules/claudia-api-builder/src/api-builder.js:98:15)\"]}"
}

I have run claudia update --configure-slack-slash-command and updated it with the slack API token, so I am not exactly sure where I need to provide the token in my test JSON?

Issues while creating a new bot

I am following tutorial at https://claudiajs.com/tutorials/hello-world-chatbot.html

After executing

claudia create --region us-east-1 --api-module bot

I see following message

project name is missing. please specify with --name

When I specify the name

claudia create --region us-east-1 --api-module bot --name mybot

I see following message. The newly created bot is not deployed.

package.json does not contain the files property

Location Quick Reply is now deprecated

Claudia.js /
In this example, return new fbTemplate.Text('Test Quick Replay ?').addQuickReplyLocation() .get();
When the request is made, we get an error back.

"dependencies": {
"claudia": "^5.12.0",
"claudia-bot-builder": "^4.0.0",
},

{
ERROR:  {
    headers: {
      'access-control-allow-origin': '*',
      'x-app-usage': '{"call_count":0,"total_cputime":0,"total_time":0}',
      'x-fb-rlafr': '1',
      'x-fb-request-id': 'A2kE_skUtmtha4Rrsms2ECq',
      'strict-transport-security': 'max-age=15552000; preload',
      'x-fb-trace-id': 'G6iqbHQ7E74',
      'facebook-api-version': 'v9.0',
      'content-type': 'text/javascript; charset=UTF-8',
      'x-fb-rev': '1003180565',
      'cache-control': 'no-store',
      pragma: 'no-cache',
      expires: 'Sat, 01 Jan 2000 00:00:00 GMT',
      'www-authenticate': 'OAuth "Facebook Platform" "invalid_request" "(#100) Location Quick Reply is now deprecated on API 4.0. Please refer to our Developer Documentation for more info."',
      'x-fb-debug': 'DtYL8sFygV1NHVp1nSnpbwzY89rlaQ4OVwRASISn2i500o37nRHjnIgFCnokA8t2LtHeJs0v8uZuTZVmjpxK0w==',
      date: 'Wed, 13 Jan 2021 22:23:36 GMT',
      'alt-svc': 'h3-29=":443"; ma=3600,h3-27=":443"; ma=3600',
      connection: 'close',
      'content-length': '238'
    },
    body: '{"error":{"message":"(#100) Location Quick Reply is now deprecated on API 4.0. Please refer to our Developer Documentation for more info.","type":"OAuthException","code":100,"error_subcode":2018286,"fbtrace_id":"A2kE_skUtmtha4Rrsms2ECq"}}',
    statusCode: 400,
    statusMessage: 'Bad Request'
  }}

How to implement delayed response?

I am building a bot that performs whois lookups for any domain the user provides. The whois lookup service can take a few seconds, and the limit for the server to respond to Slack is 3 seconds. Currently Claudia Bot Builder only allows me to return a string or JSON object to the request. I'm trying to figure out a way to take advantage of delayed responses, so I can return a string right away and then POST a message to the Slack channel after the whois lookup completes.

Here's a working example that shows I can post a delayed response as long as I do it before returning:
(note: rp is the "request-promise" library and lookup is whois.lookup, promisified).

return lookup(request.callback_id).then(function(data) {
    return rp({
        url: request.response_url,
        method: "POST",
        json: true,
        body: {
            'response_type':'in_channel',
            'replace_original':false,
            "attachments": [
        {
          "text": "```"+data+"```",
          "mrkdwn_in": ["text"]
        }
        ]
        }
    }).then(function(body) {
        return {
            'response_type':'in_channel',
            'replace_original':false,
            "text":"OK"
        };
    });
}).catch(function(err) {
    return rp({
        url: request.response_url,
        method: "POST",
        json: true,
        body: {
            'response_type':'in_channel',
            'replace_original':false,
            "text":"WHOOPS"
        }
    }).then(function(body) {
        return {
            'response_type':'in_channel',
            'replace_original':false,
            "text":"WHOOPS"
        };
    });
});

Outcome:
screen shot 2016-07-05 at 2 50 36 pm

But this does not:

lookup(request.callback_id).then(function(data) {
    console.log('we here!')
    rp({
        url: request.response_url,
        method: "POST",
        json: true,
        body: {
            'response_type':'in_channel',
            'replace_original':false,
            "attachments": [
        {
          "text": "```"+data+"```",
          "mrkdwn_in": ["text"]
        }
        ]
        }
    });
}).catch(function(err) {
    rp({
        url: request.response_url,
        method: "POST",
        json: true,
        body: {
            'response_type':'in_channel',
            'replace_original':false,
            "text":"Sorry, an error occured: "+err
        }
    });
});;
return {
    'response_type':'in_channel',
    'replace_original':false,
    'text': 'Here is the info on file for *'+request.callback_id+'*:'
};

From what I can tell the lookup never executes
(note there is no attachment)
screen shot 2016-07-05 at 2 54 08 pm

Also the console.log message doesn't appear in my logs.

Any help here? Is this not possible with Claudia Bot Builder?

InvalidClientTokenId: The security token included in the request is invalid.

* Expected behaviour:
Create the Facebook-messenger bot

* What actually happens:
After exectuting claudia create --region us-east-1 --api-module bot. I've received the error
[InvalidClientTokenId: The security token included in the request is invalid.]

*** Which bot engine (facebook, skype...):**
Facebook

* Link to a minimal, executable project that demonstrates the problem:
https://github.com/thierryskoda/claudia-facebook-bot-example

* Steps to install the project:
npm install

* Steps to reproduce the problem:
execute claudia create --region us-east-1 --api-module bot

**Screenshot*
screen shot 2016-08-11 at 4 42 47 pm

Cannot read property 'token' of undefined

I can't seem to get even the simplest example up and running, so I am not sure if this is a bug or I am just not sending the correct headers / data.

Here's an example project that I am trying to use

Even with the sample bot.js example I am getting:

POST /latest/slack/slash-command HTTP/1.1
Host: xxxx.execute-api.us-east-1.amazonaws.com
Content-Type: application/json
token: asldfjklsdfkjasdf0s9809f8
slackToken: asldfjklsdfkjasdf0s9809f8
Cache-Control: no-cache

{
    "token": "asldfjklsdfkjasdf0s9809f8",
    "command": "bot",
    "text": "hi",
    "team_id": "T0001",
    "channel_id": "C2147483705",
    "channel_name": "test",
    "user_id": "U2147483697",
    "user_name": "steve"
}
{
    "errorMessage": "Cannot read property 'token' of undefined",
    "errorType": "TypeError",
    "stackTrace": [
        "/var/task/node_modules/claudia-bot-builder/lib/slack/setup.js:14:21",
        "ApiBuilder.self.router (/var/task/node_modules/claudia-bot-builder/node_modules/claudia-api-builder/src/api-builder.js:98:15)"
    ]
}

Typing Indicators

Sorry for the general question guys but I can't get into your Gitter channel, it just won't load for me :(

I just want to know if it's possible to set the typing indicators whilst waiting for the bot to reply on Facebook?

I've searched everywhere before asking this and waited for 30 minutes to try and get into Gitter but no luck.

Thanks

Custom Termination Not Working...

Probably missing something but here goes:

I have a bot that makes an api request and returns a result. Sometimes the whole roundtrip takes too long so I'm trying to do custom termination.

var request = require("request")
var botBuilder = require('claudia-bot-builder');
module.exports = botBuilder(function (message, request) {
  console.log("Never gonna give you up...");
  var rick = new Promise((a, b) => { console.log('Never gonna give you up...') }).then((a) => { 'Never gonna drag you around....' });;
  return rick
  response_url = message.originalRequest.response_url;
var rock = new Promise((resolve, reject) => {
  request({
    url: response_url,
    method: "POST",
    json: {
      text: "my delayed response"
    }
  });
}).then((data) => { request.lambdaContext(null, "done"); })
console.log("Or hurt you.");
request.lambdaContext.done(null)
})

In amazon I just see the following in cloudwatch:

START RequestId: 4c0bef2b-4566-11e6-93fe-c176baba64f0 Version: $LATEST 
2016-07-08T23:47:14.642Z    4c0bef2b-4566-11e6-93fe-c176baba64f0    Never gonna give you up... 
2016-07-08T23:47:14.643Z    4c0bef2b-4566-11e6-93fe-c176baba64f0    Never gonna give you up... 
END RequestId: 4c0bef2b-4566-11e6-93fe-c176baba64f0 
REPORT RequestId: 4c0bef2b-4566-11e6-93fe-c176baba64f0  Duration: 4.08 ms   Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 27 MB

Contrary to documentation, facebook echo messages are parsed and passed to bot

In https://github.com/claudiajs/claudia-bot-builder/blob/master/lib/facebook/parse.js line 31, the Facebook parser tries to avoid parsing echo messages by checking messageObject.message.is_echo. This would work, except that the check never happens because echo messages pass the first check on line 4 (messageObject && messageObject.sender && messageObject.sender.id && messageObject.message && messageObject.message.text && !messageObject.message.quick_reply).

Either line 4 needs to check is_echo, or the ordering of the if/then statements needs to be changed.

For reference, here's a message that my bot got:

{
    "sender": "12345",
    "text": "Some text",
    "originalRequest": {
        "sender": {
            "id": "12345"
        },
        "recipient": {
            "id": "54321"
        },
        "timestamp": 1483413621558,
        "message": {
            "is_echo": true,
            "app_id": 314159,
            "mid": "mid.1483413621558:a9dc28cb84",
            "seq": 1022,
            "text": "Some text"
        }
    },
    "type": "facebook"
}

Web API Support

Hi.

I know this is not a bug, but here it goes:
Can this be used with a simple web API? I don't see it in the documentation.
As far as i can tell, it only works with Messenger, Skype, Telegram and Slack. Is there way that can be used with a web API?
Also how could i use it with Serverless instead of Claudia? The main problem is that i can't do any real testing without lambda servers.

Thanks.

Viber is retired or what ?

I was following your tutorial about making a Viber bot from https://claudiajs.com/tutorials/viber-chatbot.html

It seems like Viber retired/removed making a Public Account.
Opening it's page gets us "This account does not exist or has been removed".

Does that mean that we can't make new bots anymore ? If that's the case i guess someone has to redo the docs and remove Viber support.

url in button postback caught by facebook

  • Expected behaviour: url mingled with other text sent as a string payload

  • What actually happens: facbeook caught it as an invalid url

  • Which bot engine (facebook, skype...): facebook

  • Link to a minimal, executable project that demonstrates the problem: communicated with @stojanovic

  • Steps to install the project: N/A

  • Steps to reproduce the problem: N/A

Slack Bot integration

Hi Guys ,

Is it possible for me to configure the bot client to use a slack bot instead of a slash command ?

Generic template example for facebook does not work

  • Expected behavior:
    It should display the same result shown in the documentation page; two bubbles with images, names...etc.

  • What actually happens:
    It stops the whole server showing an error of:
    info: An error occurred while sending a message: { message: '(#1) Cannot specify both item_url and default_action', type: 'OAuthException', code: 1, error_subcode: 2018085, fbtrace_id: 'DDHRAtuDFtB' }

  • Which bot engine (facebook, skype...):
    facebook

  • Steps to reproduce the problem:
    Just copy the same example and try it.

This is my first issue ever, so please tell me if I did something not correct. I fixed it by deleting "addDefaultAction".

Facebook Configure / Setup Script Not working on newly created Page/App (using v3.2 Graph API)

  • Expected behaviour:
    After running claudia update --configure-fb-bot, the bot should exit successfully (indicating succesful bot setup)

  • What actually happens:
    However, on newly created App (using newly created Page), it seems that this App is mandatorily using v.3.2 Graph API, and it exit with following error:

{"error":{"message":"(#100) The parameter subscribed_fields is required.","type":"OAuthException","code":100,"fbtrace_id":"xxxxxxx"}}

  • Which bot engine (facebook, skype...):
    Facebook

  • Link to a minimal, executable project that demonstrates the problem:

  • Steps to install the project:
    Any Standard Facebook Bot

  • Steps to reproduce the problem:
    On a newly created Facebook App (on newly created Facebook Page),
    run: claudia create --region ap-southeast-1 --api-module bot
    then, run : claudia update --configure-fb-bot

after awhile, it exit with following error:
{"error":{"message":"(#100) The parameter subscribed_fields is required.","type":"OAuthException","code":100,"fbtrace_id":"xxxxxxx"}}

Your Facebook webhook is insecure.

I had a quick look at your video. Facebook uses app secret to generate signature which is part of very request. Only the app owner knows about this secret. You never ask about the secret in the video, which means that your webhook accept request from whoever call it, which is highly insecure. Hope this helps:

The problematic code is here:

 api.post('/facebook', request => {
    let arr = [].concat.apply([], request.body.entry.map(entry => entry.messaging));
    let fbHandle = parsedMessage => {
      if (parsedMessage) {
        var recipient = parsedMessage.sender;

        return Promise.resolve(parsedMessage).then(parsedMessage => bot(parsedMessage, request))
          .then(botResponse => responder(recipient, botResponse, request.env.facebookAccessToken))
          .catch(logError);
      }
    };

You never check the request signature :)

duplicated videos + Lambda requests timeout

We are testing the bot on messenger.

Works fine for all other requests except when returning a video.

2 things happen:

  1. The video appears 3 times in the chat window, instead of once.. as if the client was for some reason considering the requested failed and redoing the requests 2 more times.
  2. Even thou alll the function is doing is generating a simple json template for facebook to consume, execution times out after 3000 ms

After increasing the lambda timeout limit to 10000 ms the video duplication problem seems to be mitigated, however the the function still times out.

We tested to log the output of the handler function and it's the same both using fbTemplate as well as building the JSON template by hand and it doesn't seem to have an effect.

The result of the function we wrote logs as this value:

{ attachment: 
{ type: 'video',
payload: { url: 'https://s3-sa-east-1.amazonaws.com/avidotec/videos/make-me-fat-playing-mode.mp4' } } }

NOTE: This also happens with example videos from the docs so the problem is not the video file

Facebook List template and addImage

When I use the List template of the facebook bot it seems that addImage is required for the first bubble. Just doing a copy/paste of your example and removing the first addImage should reproduce the problem:

const botBuilder = require('claudia-bot-builder');
const fbTemplate = botBuilder.fbTemplate;

module.exports = botBuilder(message => {
  if (message.type === 'facebook') {
    const list = new fbTemplate.List();

    return list
      .addBubble('Claudia.js', 'Deploy Node.js microservices to AWS easily')
        .addDefaultAction('https://github.com/claudiajs/claudia-bot-builder')
        .addButton('Say hello', 'HELLO')
      .addBubble('Claudia Bot Builder')
        .addImage('https://claudiajs.com/assets/claudia-bot-builder-video.jpg')
        .addButton('Go to Github', 'https://github.com/claudiajs/claudia-bot-builder')
      .addListButton('Contact us if you like it', 'https://claudiajs.com')
      .get();
  }
});

ClaudiaJS Facebook checkbox-plugin callback not handled

Please use GitHub issues only to report bugs. To ask a general question or request assistance/support, please use the Claudia.js Gitter Chat instead.

To report a bug or a problem, please fill in the sections below. The more you provide, the better we'll be able to help.


  • Expected behaviour:
    I would expect to be able to see the callback:
    { "recipient":{ "id":"PAGE_ID" }, "timestamp":1234567890, "optin":{ "ref":"PASS_THROUGH_PARAM", "user_ref":"UNIQUE_REF_PARAM" } }

  • What actually happens:
    I just see an event hitting my webhook url but the callback is never delivered.

  • Which bot engine (facebook, skype...):
    facebook

  • Link to a minimal, executable project that demonstrates the problem:

  • Steps to install the project:

  • Steps to reproduce the problem:
    You can test this out by going to the webhooks section of Facebook Developer and trying a test call to messenger. You will notice that the request var you get back when you call botBuilder is empty when it shouldn't be.

Facebook generic template button value not working ..

The below code displays the button correctly in Facebook Messenger, but upon clicking the button, it sends 'Say Hello' instead of 'hello'.

let sayhello = new fbTemplate.Generic();
sayhello.addBubble('Hello');
sayhello.addButton('Say Hello','hello');

*** Expected behaviour:**
Clicking the 'Say Hello' button should send the button value, 'hello' as the postback

*** What actually happens:**
Upon clicking the button it sends the button title/caption, 'Say Hello' as the postback.

*** Which bot engine (facebook, skype...):**
Facebook Messenger

  • Link to a minimal, executable project that demonstrates the problem:

  • Steps to install the project:

*** Steps to reproduce the problem:**
Try the above code snippet in a Messenger bot.

Configure Slack command fails

Hi guys,

When calling:

claudia update --configure-slack-slash-command

After successfully deploying the bot to AWS, I receive the following error:

loading Lambda config   lambda.setupRequestListeners
{ CredentialsError: Missing credentials in config
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/claudia/node_modules/aws-sdk/lib/http/node.js:83:34)
    at ClientRequest.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at ClientRequest.emit (events.js:185:7)
    at Socket.emitTimeout (_http_client.js:630:10)
    at Socket.g (events.js:292:16)
    at emitNone (events.js:86:13)
    at Socket.emit (events.js:185:7)
    at Socket._onTimeout (net.js:338:8)
    at ontimeout (timers.js:386:14)
  message: 'Missing credentials in config',
  code: 'CredentialsError',
  time: 2017-08-23T17:35:07.540Z,
  retryable: true,
  originalError:
   { message: 'Could not load credentials from any providers',
     code: 'CredentialsError',
     time: 2017-08-23T17:35:07.540Z,
     retryable: true,
     originalError:
      { message: 'Connection timed out after 1000ms',
        code: 'TimeoutError',
        time: 2017-08-23T17:35:07.539Z,
        retryable: true } } }

Failed to decrypt pairwise Id error with Skype bot

I'm running into a 400 error: Failed to decrypt pairwise Id when trying to interact with a simple skype bot. Could this be related to recent authentication changes?

'use strict'

const botBuilder = require('./lib/claudia-bot-builder')

module.exports = botBuilder(function (message, originalApiRequest) {
  return `I got ${message.text}`;
}, { platforms: ['skype'] });

Telegram addInlineKeyboard responses not working

  • Expected behaviour: When a user press a button in an inline keyboard (addInlineKeyboard) in a telegram bot, the server should receive the button 'callback_data'

  • What actually happens: The server receive a response, but the handler function is not executed

  • Which bot engine (facebook, skype...): Telegram

  • Link to a minimal, executable project that demonstrates the problem:

  • Steps to install the project:

  • Steps to reproduce the problem:

Deploy to HEROKU

Da li postoji jednostavan način da se prilikom korišenja claudia-bot-builder-a izvrši deploy na Heroku?

Emoji prevents Viber messages

I followed the tutorial https://claudiajs.com/tutorials/viber-chatbot.html and it's working well. However, when the bot receives a string containing an emoji, such as 😀 , the reply never reaches Viber. I have checked that request.text (in bot.js) does contain the correct string, so it seems the reply gets lost inside the bot builder code itself. Also, I did verify that sending 😀 directly to the Viber API does result in a message.

Receipt Template Doc Error + OAuth "Facebook Platform" "invalid_request" "(#100) Invalid keys \\"total_amount\\" were found in param \\" Key

  • Expected behaviour:
    Display receipt
  • What actually happens:
    Invalid Key : OAuth "Facebook Platform" "invalid_request" "(#100) Invalid keys "total_amount" were found in param "
  • Which bot engine (facebook, skype...):
    facebook

I literally cc'ed the doc code, had to fix currency (need to be ISO 4217, not '$' but 'USD') + total_amount raise invalid_keys.

Code:

function sendReceiptMessage(recipientId) {
  return new fbTemplate.receipt('Pizza order', 'ORDER-123', 'USD', 'Paypal')
    .addTimestamp(new Date())
    .addItem('Pizza')
      .addSubtitle('32cm')
      .addQuantity(1)
      .addPrice(4.99)
    .addShippingAddress('Some street 123', null, 'San Francisco', '123',  'CA', 'US')
    .addTotal(4.99)
    .get();
}

`claudia: command not found` error

With the latest version of claudia ([email protected]), both installing the package locally (npm -S) or globally (npm -g) the claudia script is missing and trying to run claudia ... commands raises the claudia: command not found error.

My node version is v8.0.0, npm in 5.3.0, running on MacOSX.

Missing postback property on Telegram Bot

Please use GitHub issues only to report bugs. To ask a general question or request assistance/support, please use the Claudia.js Gitter Chat instead.

To report a bug or a problem, please fill in the sections below. The more you provide, the better we'll be able to help.


  • Expected behaviour:
    I've been playing with telegram bot. In the message schema defined in the documentation, I can see there is a postback property. When I try to access it is always undefined, but it should be set when replying to a command (for telegram bot when callback_query property exists in the response message object).

  • What actually happens:
    It is not set.

  • Which bot engine (facebook, skype...):
    telegram

  • Link to a minimal, executable project that demonstrates the problem:

https://github.com/claudiajs/claudia-bot-builder/blob/master/lib/telegram/parse.js#L32

As I understand it, the line below should include a property postback: true.

  • Steps to install the project:

  • Steps to reproduce the problem:

Unable to send responses to FB messenger after a database call

Hi, we're currently building a bot which writes the user's responses into a database (for future reference later in the conversation). However, when we execute a mysql command and return any form of textual response to the user (even simple text, non related to database return data) an error is seen in Amazon CloudWatch.

Bot Engine Used: Facebook
Database Engine + node.js library: mysql
Database location: Amazon RDS (made the database accessible in the public internet to rule out permission issues).

Code: main.js

'use strict';
const builder = require('claudia-bot-builder'),
    fbTemplate = builder.fbTemplate,
  db = require('./src/db');

module.exports = builder((request, apiReq) => {
  apiReq.lambdaContext.callbackWaitsForEmptyEventLoop = false;

db.getUserDetail('hello world', "SUBSTEP", function(err, returnData){
        if(err) return err;
        else
        {
            console.log(returnData); //this writes the expected output inside CloudWatch
            return "text to send to FB messenger"; //this yields an error inside CloudWatch
        }
    });
});

Code: db.js

const mysql = require('mysql');

var connection = mysql.createConnection({
        host: <host>,
        user: <user>,
        password: <password>,
        database: <database>,
        debug: false
    });

module.exports = {
    getUserDetail(userID, type, callback) {
    try{
        switch (type){
            case "SUBSTEP": queryString = "<actual query>";
                break;
        }

        connection.connect(); //establishes the connection.
        connection.query(queryString, function(err, data, fields) {
            if (err){
                callback(err, null);
            }
            else{
                callback(null, data[0]);
            }
        });

    }catch(ex){
        callback(ex, null);
    }
    finally{
        connection.end();
    }
  }
}

Error from CloudWatch:
{ headers: { 'www-authenticate': 'OAuth "Facebook Platform" "invalid_request" "(#100) Must send either message or state"', 'access-control-allow-origin': '*', pragma: 'no-cache', 'cache-control': 'no-store', 'facebook-api-version': 'v2.7', expires: 'Sat, 01 Jan 2000 00:00:00 GMT', 'content-type': 'text/javascript; charset=UTF-8', 'x-fb-trace-id': 'CB/lulmfQSL', 'x-fb-rev': '2503827', vary: 'Accept-Encoding', 'x-fb-debug': 'ufWokB+8KDSDGmLHKtdSmanvhD7yVHWD8JO8Mjv+8lmr7KNqLMw82XduFseKU4ZooE+3QpXgSwDCrdqSbCIbnQ==', date: 'Sun, 14 Aug 2016 18:18:44 GMT', connection: 'close', 'content-length': '127' }, body: '{"error":{"message":"(#100) Must send either message or state","type":"OAuthException","code":100,"fbtrace_id":"CB\\/lulmfQSL"}}', statusCode: 400, statusMessage: 'Bad Request' }

What has been tested (does not work sadly):

  1. Updating timeout from 3 seconds to 10 seconds. Based from the logs - Amazon Lambda responds within 1 - 3 seconds currently.
  2. Shifting the function call from a callback based to a return based function.

Any help would be much appreciated. Thanks!

support delays between messages when bot returns an array

would be great if there was delay between each message when sending multiple - with typing indicator.

I guess to implement this on facebook you would have to listen out for the message echo and sent each message after receiving the previous message's echo?

Facebook replies over and over endlessly

Hi, built a simple Facebook integration that just echoes the text and it's replying over and over and over (and after the first reply it has lost the text from the request).
screen shot 2016-07-07 at 6 47 33 pm

Alexa skill: The skill end-point is not validating the signatures for incoming requests and is accepting requests with an empty signature URL.

We're using Claudia.js to deploy a lambda function for an Alexa skill. Everything works on their platform after running claudia update locally, but when we submit the skill for certification, it fails and says:

The skill end-point is not validating the signatures for incoming requests and is accepting requests with an empty signature URL. Please check if your signature validation is correct. To reject an invalid request (with an invalid signature or certificate), the skill should respond with an HTTP status code 400 (Bad Request). Please refer to our documentation on how to build your Alexa Skill as a web service and validate requests and signatures.

  • Link to a minimal, executable project that demonstrates the problem:
    Our skill's repo: https://github.com/tylerl0706/alexa-spell

  • More info:
    In the Alexa skill SSL cert page, I put in the URL generated by Claudia and also checked the " My development endpoint is a sub-domain of a domain that has a wildcard certificate from a certificate authority" option.

Character limit on Claudia's Button template differs from Facebook specs

Please use GitHub issues only to report bugs. To ask a general question or request assistance/support, please use the Claudia.js Gitter Chat instead.

To report a bug or a problem, please fill in the sections below. The more you provide, the better we'll be able to help.


  • Expected behaviour:

As I understand it, Claudia is mapping the Button template to the Facebook button template. According to the facebook docs, the text field should be able to handle up to 320 characters:

text must be UTF-8 and has a 320 character limit

  • What actually happens:

...however, when I actually run it, I seem to be limited to 80 characters. This code works:

  const text = Array(80).fill("x").join('')
  return new builder.fbTemplate.Button(text)
    .addButton('foo', 'bar')
    .get()

and this code does not work:

  const text = Array(81).fill("x").join('')
  return new builder.fbTemplate.Button(text)
    .addButton('foo', 'bar')
    .get()
  • Which bot engine (facebook, skype...):

facebook

  • Link to a minimal, executable project that demonstrates the problem:

I can provide one if necessary, but any configured facebook chatbot should have the same behavior.

  • Steps to install the project:

no special configuration

  • Steps to reproduce the problem:

try to render a Button with text > 80 chars

"Build Failed" issue

Hi Claudia.

I used this package in my project for generating json data of FB templates.
It is running very well.

But during the build, I got this issue
"Failed to minify the code from this file:

./node_modules/claudia-bot-builder/node_modules/souffleur/index.js:12 

Read more here: http://bit.ly/2tRViJ9

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above."

Maybe it looks it is not pre-compiled to ES5.
How can I solve it?
Thanks.

SQS/SNS

Any thoughts on using SQS and SQS to guarantee delivery of messages?

Executing against an alias other than LATEST isn't working

  • Expected behaviour:
    I promote my APIs to a --version of "staging", and when I execute those APIs using a URL with <my_domain>/staging/, it should execute against that alias

  • What actually happens:
    It only works if I do <my_domain>/latest/
    In particular, it logs from my custom authoriser that there are not enough permissions to execute (it accesses dynamodb) - but that role has permission to dynamodb and works fine with LATEST. It just won't work with STAGING

I've manually combed over the API Gateway stage variables, and the link to the lambda function, and the alias to the lambda function does seem to be inheriting the same role as what is used for LATEST.

Any clues?

is it possible to update the configuration?

when i run claudia update --configure-viber-bot
or
is it possible to do it manually because its not getting prompted I believe it had previous token but can't seam to reconfigure it.

Issue
claudia update --configure-viber-bot it doesn't prompt token input

I also tried but it doesn't prompt token
claudia create --region ap-northeast-1 --api-module bot --configure-viber-bot

i'm also having issue with running it on vpc can the url be modified? i was thinking maybe the webhook isn't working because of vpc but without vpc the bot can work but now i can't access database like rds proxy

support a debug mode

where you catch exceptions and convert them to string and send them  as messages to user

save me doing:

module.exports = builder(message, apiRequest) => {
    try {
      //bot code here
    } catch(error) {
        return String(error);
    }
})

Telegram Inline Query Request: wrong sender field

  • Expected behaviour:
    For telegram inline query request: sender field should be equal to actual user_id.

  • What actually happens:
    Sender Field is equal to inline_query id.

    "sender": "512944664604439953",
    "text": "share",
    "originalRequest": {
        "update_id": 920742096,
        "inline_query": {
            "id": "512944664604439953",
            "from": {
                "id": 119429236,
                "first_name": "Sergey",
                "last_name": "Tverskikh",
                "username": "tverskih"
            },
            "query": "share",
            "offset": ""
        }
    },
    "type": "telegram"
}
  • Which bot engine:
    Telegram

  • Link to a minimal, executable project that demonstrates the problem:
    Any telegram inline query

How to handle errors when replying?

I'm back again! The bot I'm building lets people search domain name availability. To test it, I tried "claudia" and one of the results is claudia.org. Unfortunately, it turns out that claudia.org is deemed an "unsafe URL" by Facebook, and any message containing that is automatically blocked by Facebook Messenger. The message (a big generic template message with 5 elements in the attachment) fails to send. Is there a way to handle errors when replying with Claudia Bot Builder?

p.s. here's the error that gets logged when trying to send the message:

{ headers:  { 'www-authenticate': 'OAuth "Facebook Platform" "invalid_request" "(#2022) Your message couldn\'t be sent because it includes content that other people on Facebook have reported as abusive."', 'access-control-allow-origin': '*', pragma: 'no-cache', 'cache-control': 'no-store', 'facebook-api-version': 'v2.6', expires: 'Sat, 01 Jan 2000 00:00:00 GMT', 'content-type': 'text/javascript; charset=UTF-8', 'x-fb-trace-id': 'A4qKNufqFlK', 'x-fb-rev': '2455931', vary: 'Accept-Encoding', 'x-fb-debug': 'IRzVg2dR09ZaEDhI++brtE7adsuTk1/Sp7p886mSobaK4tbS5iT/Xb4ex4yDhN7rtjSVDIuxAlST2+kc4HN7/Q==', date: 'Wed, 20 Jul 2016 16:54:24 GMT', connection: 'close', 'content-length': '208' }, body: '{"error":{"message":"(#2022) Your message couldn\'t be sent because it includes content that other people on Facebook have reported as abusive.","type":"OAuthException","code":2022,"fbtrace_id":"A4qKNufqFlK"}}', statusCode: 400, statusMessage: 'Bad Request' }

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.