Facebook chatbot with node, express.js, ngrok and Dialogflow - node.js

I made this bot using express.js, node.js and ngrok. Its automatic answers are working fine, but this is happening only to my user, the user which created its facebook page, if other people message it, it won't respond.
I've already made it public, I have no idea what to do. What do I need to do so the bot respond to all users that message him?
I think its something about the Facebook configuration, because the bot is responding properly. How can I get help on this?

Before a Facebook app goes to live, you have to make sure by the facebook authority, the app is using data in an approved manner.
From your app dashboard, you have to submit the application for review.
Before you can switch your app to Live mode, we may need to make sure
that you will be using our products and data in an approved manner. To
achieve this goal, we require many apps to undergo App Review.
Without reviewing the application only the developers and the page associates can interact with the bot.
Check the docs here.

Related

Connect slack with simple web api token but not with Slack bot or slack app

As a leisure project, I created a small project that updates slack status whenever an event is added/updated in Google Calendar (Just like the Google calendar app on Slack). Whatever I implemented till now works as expected but I did so by creating a new Slack app, which I don't want to do - In other words, I am trying to integrate Google Calendar with Slack, without any Slack bot or Slack app setup. At least this is what Zapier does - It asks for authentication to Google calendar & Slack, and integrates them without having a Slack bot or Slack app.
I referred to Slack API docs but couldn’t find any page helpful enough to work without a Slack bot or Slack app, and simply with a Web API token.
I think I found a page closer to what I need but this too requires a client ID and client secret which are possible if a new app is created.
It's no longer possible to generate an API token on its own for Slack. If it helps, you can just think of a Slack app as a simple container representing what you want to accomplish. Install the Slack app to get the token and then use the token for that purpose. You don't need to learn or implement OAuth or provide much more than a name to retrieve a token scoped to the activities you wish to accomplish.

Send a Google Chat message from a regular account (not a bot)?

I'm trying to send a notification out using Google Chats. But I have a few problems with the documentation I've been able to find:
It requires me to have a paid service account, which I do not have, and will not be getting
It requires using a chat bot, which (in my understanding) needs to be added to a room, and cannot just send out messages
Chat bots can't send out messages directly to personal accounts?
I'm already using Google OAuth2 authentication to access another Google API, so I'd like to use a Google API to send messages directly from the authenticated account. How would I do that?
So far:
All the documentation I can find is about making a chat bot.
I've considered some alternatives to sending out messages, but due to corporate device restrictions that will not be changing, google chats is my best option.
At the moment what you're trying to do is not possible, for multiple reasons.
You may know this already, but Google Chat is an upgrade to their old "Classic Hangouts" chat. In Google's own words, this is focused on enterprise (i.e. paid) accounts. While personal accounts are also able to upgrade and get some of the benefits, their documentation shows that Google Chat for personal accounts is very similar to the old Hangouts and most of the new features are meant for the paid accounts. This also includes the use of bots.
As you've observed, the Chat API currently only has methods to create and manage bots. There are no methods to send messages as your own account. This could be to prevent spam or because their Chat API is relatively new, since the Classic Hangouts did not have an API, and Chat hasn't fully replaced it yet. Even then, given that Chat is "enterprise-focused", it is uncertain whether or not personal accounts would get access to any new API features.
You could try to post feedback on their issue tracker or request the feature to see if you get a response, but for an immediate solution you may want to just use the Gmail API to send a regular email or reconsider the other alternatives that you had in mind.

Instagram webhook not activating

My goal is to use the Facebook webhooks to get a notification whenever an IG user mentions my IG account. For that I have followed these steps:
I have created a Facebook page and connected it with an Instagram business account.
I have created a Facebook app (which is now live) and added the product "webhooks".
I have connected my app with my page.
I have created a webhook and subscribed to the mentions event.
I have tested the webhook, using the tools provided by Facebook and it works.
The problem I'm facing is that I can't get my app to work with real data. I have tried to mention my business IG account from my IG personal account, but nothing happens. My callback url is not getting called.
My app doesn't need users to login, so I'm not sure if I need to send my app for review. Do I need a special permission?
I had the same problem. For my case, when I installed the app via graph api explorer, the page token I was using didn't have the instagram_manage_insights permission. So I granted that permission, got a new token, re did the POST request to the {page-id}/subscribed_apps again with the new token and that fixed the problem. Just for the record, I used a system user token from the business manager.
Did you verified your Facebook app via app review? If not, you won't get production data via a webhook callback for the Instagram. I had the same issue and asked the Facebook support and got following response:
However, this is not the same for instagram or pages. This is just how the product teams have decided to implement it. For app review, you can show a mock process of the flow, using either the test webhook or your own process. The app review is less about technical implementation steps, but just a way to make sure that your app is going to use the permission in a way that follows our guidelines, so mocking the procedure should be fine. The reviewers understand that you do not receive webhooks in dev mode and should take this into consideration.
For more information check out following links:
Why is the Instagram Graph API webhook not working
https://developers.facebook.com/support/bugs/495933900986533/
I just figure it out of this problem.
There is a mistake in the official Instagram webhook guide:
With Graph API version 3.2, the /{page-id}/subscribed_apps edge now requires the subscribed_fields parameter, which currently does not support Instagram webhooks fields. To get around this, use your app's dashboard to subscribe.
https://developers.facebook.com/docs/instagram-api/guides/webhooks/#install-app
However, the app's dashboard subscribe is another function. You need your page to subscribe to some field to receive webhooks
Just POST /{your-instagram-connected-page-id}/subscribed_apps?subscribed_fields=feed&access_token={your-instagram-connected-page-token}
Then you will receive webhooks in live mode.

How to Auth from an external service to the bot framework?

I have an external service with is own database where the users can log in.
Now I have a bot in NodeJS using Bot Builder and the Bot Framework.
I want to link them.
Is there anyway that the bot recognize the users from the other service everytime they open a new conversation and everytime they write something in the bot?
I've just tried with web chat before and I know that with channels that they support like Facebook, Telegram, Skype etc is easy to recognize the users every time they come back, but I don't know how if it is possible to do this with an external service where the users are already logged in and they want to talk with the chatbot.
I don't know how could I generate an authtoken or something that the bot framework read it and recognize the user.
You can use the DirectLine API to allow your bot and a custom client to communicate to each other, a sample can be found here, and here if you want to use WebSockets.
You can also add authentication to your bot via Azure Bot Service to use OAuth as stated here, where you will find samples too.

Bot Framework bot randomly doesn't answer messages

I have a bot that consists of a Facebook Messenger connected to my bot code via the Microsoft Bot Framework. The bot works fine in the webchat, however on Facebook Messenger only about 1/3 of my messages get delivered to the bot.
That means that I have to send "hi" three or four times before the bot answers me once. Before it answers, the message shows as undelivered. There is nothing in the Bot Framework log in the web interface at dev.botframework.com, and my bot code (running on Azure) doesn't even receive anything from the bot framework - no HTTPS request whatsoever. When it does receive something (which, again, is about 1/3 of the times), the bot answers properly.
In facebook settings, I am using the standard endpoint (https://facebook.botframework.com/api/v1/bots/[my bot name]).
It just seems that most messages are somehow lost between Facebook and Bot Framework, and never reach my bot code.
There is no logging on the Facebook side so I'm out of ideas how to debug - there are no traces of any errors anywhere.
Update: the problem seems to occur only with bots registered using the Microsoft's new method of registering bots via Azure Portal. Bots registered at dev.botframework.com don't seem to be affected.
In case the application is hosted in an Azure WebApp or Azure Function App, please turn on Always On for the application. Might be when you call the Bot API, it switches it from stand by mode to On, that might come with some latency since Microsoft idles it's WebApp by default. And by default, Always On is kept to OFF.
Refer here to turn On , Always ON.
If you have not hosted the Bot Framework in Azure, then it might be a different issue altogether.

Resources