capture json message sent by facebook to bot framework - facebook

How can i track the response that was received to bot framework from facebook or any another social network ?
For example , I am sending the location on facebook ( which is not available on framework ) and i am not able to know where it's sent .
Is there any tracker on the bot framework site that can help me do that ?

There are several ways to get information about the messages sent to your bot.
Create an Azure App Insights instance and register it with the bot framework portal and the Bot Framework will send traces to your bot including exceptions, errors, etc.
Run NGROK locally on your machine and point it to your local bot in debug, and you can use the NGROK console to see the rest calls.
Inspect the post as it comes into your bot and log the message from the message context.
--jim

The message from facebook, including the location sent by user, is available from:
var facebookJson = activity.ChannelData;

Related

In which format I should send http POST to Bot Builder?

I was trying to built a bot which interacts with multiple users.
The Microsoft Bot Builder seems nice to me.
I followed their examples and tried them out.
Bot Builder Restify and so on
There are few things which are not clear to me.
How can I post a message to bot rest endpoint?
The emulator seems to have been taking care of such details. But in a real application, in which format i should sent a message?
How does the bot interacts with multiple users? In the emulator, there is only one user, what happens if there are several persons talk to the bot at the same time in a real application?
I think "chatconnector" somehow doing the job, but I am not sure.
I hope someone could point out examples or give answers below to clarify these to me.
Thanks in advance!
1) Messages are sent using industry-standard REST and JSON over HTTPS. Although you can call the bot's endpoint directly, this would bypass channels and security. In the Microsoft Bot Framework architecture, clients communicate with a channel connector and the channel connector calls the bot. When the bot responds, it sends a message to the channel connector and the connector calls the client. The channel connectors transform messages from the channel's specific schema to the Bot Framework's generic activity schema and back. They also verify that callers are authorized using JWT tokens.
This documentation on Authentication might help clear things up some: https://learn.microsoft.com/en-us/bot-framework/rest-api/bot-framework-rest-connector-authentication
2) Group conversations are handled differently, depending on the channel. This sample demonstrates some of the group conversation features in the Bot Builder Node sdk: https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-GetConversationMembers

How to trigger message without messaging bot first

I am learning the facebook api and I am curious how to do this.
On this website(https://botacademy.com/), they use manychat and you can click the opt in button (on web) and it automatically accesses your messenger inbox without prompts or auth.
It then sends you a programatic message. All of the tutorials I follow require the user to send a message first..
Do you know what endpoint of the API they are using to accomplish this?
Obviously I do not know what their code looks like, but:
that is a send to messenger button, which allows you to authenticate with a bot and an app, and sends your information to the webhook.
This counts as interacting with the bot, because you clicked the button and opted into the experience.
FBM Platform Policies have this to say about opting into messages and send to messenger:
How messaging is triggered:
...
Person requests a message from a business via a plugin, such as Send to Messenger

Why is my Bot responding with a MethodNotAllowed error?

I just started looking into the new Microsoft Bot Framework.
https://dev.botframework.com
I started with this sample:
http://docs.botframework.com/connector/getstarted/#getting-started-in-net
My new bot responds in the emulator (both local version and deployed in Azure), with the default template's sample response "You sent X characters".
Once connected to Slack and FB Messenger, I am getting responses from the Bot, but it's an error message that says "Operation returned an invalid status code 'MethodNotAllowed'"
Before I go any further and add more features, what can I do to troubleshoot and fix this, so that I can get the sample response to work via Slack and FB Messenger?
EDIT: in the dev portal, I don't get any response or error.
Thanks in advance! :-)
Give it 30s to see if you get an internet timeout because it can't find your bot. I'm guessing that maybe http vs https are out of whack on the endpoint or you're missing the /api/messages part of the endpoint URL that comes with the Bot Application template.

Integrate Facebook messenger into CRM without bot?

we have built a very simple bot that simply passes any message onto our own application. (we want to answer questions asked from our customers to be handled straight from our CRM application for customer service purpose)
Now, the bot is declined with message:
Thank you for your submission. We tested the messenger experience on your associated page and received either no response from your messenger bot or received a human response. Please resubmit with the new, improved version of your bot.
Which raises the question for me: is it even allowed to do human assistance via the messenger API? Or is it bot only? I have read through all the platform policies, use case examples, etc.
So, how do I create the simplest integration? (send message straight through to one of our customer service users?)
Making a bot is easy if you use Wit.ai which is an NLP and speech API. It can integrate with the messenger/graph API. Basically, you send text to wit.ai and it returns the intent. For example: you send "get me a large pizza" to Wit and it returns something like (intent = pizza, size=large, time = now) You could also try api.ai but in my opinion, it is not as good yet.

Sending Facebook message as specific page

I've facebook account and a fan page defined within this account.
I'm using XMPP to send private messages using the following Java code
http://yauritux.wordpress.com/2011/09/24/facebook-chat-with-smack-xmpp-api/
I can easily send and receive messages using my user id and password.
However when I try to use my page user ID I'm getting the following error:
SASL authentication PLAIN failed: not-authorized (stack below).
I tried to use pidgin but I'm getting the same error.
Let me know if you've a solution or direction on how to send a message as a page and not as a user.
Thank you in advance,
Moshe
SASL authentication PLAIN failed: not-authorized:
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:337)
at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:203)
at org.jivesoftware.smack.Connection.login(Connection.java:348)
at com.maiff.was.connectors.impl.fb.FBConsoleChatApp.login(FBConsoleChatApp.java:55)
at com.maiff.was.connectors.test.ConnectorTestMain.initFB(ConnectorTestMain.java:55)
at com.maiff.was.connectors.test.ConnectorTestMain.main(ConnectorTestMain.java:18)
Pages can only "reply" to user messages, and i am not sure if it even works with XMPP. Keep in mind that the Chat API is deprecated btw: https://developers.facebook.com/docs/chat/
Meaning, after April 2015 it will not work anymore, not even with users.
For Page conversations, there is a specific API endpoint to reply to messages: https://developers.facebook.com/docs/graph-api/reference/v2.2/conversation/messages