Gerwin Brunner
Gerwin Brunner

Reputation: 196

How to test FB messenger bot with multiple users

Has anybody yet a way to interact with an FB messenger bot without using real FB accounts? I want to do automated testing and obviously not use real accounts for that. I was not able to figure out how to allow access to a page to 'test users' or create a test page and subscribe the test app to it. Any ideas on how to do this?

Upvotes: 4

Views: 9282

Answers (4)

Kunal Parekh
Kunal Parekh

Reputation: 419

Testing fb bot with non-fb user is currently not supported. Following are the reasons:

  • fb messenger requires the user to be logged
  • fb creates page scope ids (PSID) for each user who is interacting with the bot and hence login on fb is required

Coming to your question on testing:

On another note, if you are using 3rd party apps to build your bot (eg: api.ai, wit.ai) they already have emulators within the app which makes testing easier.

Upvotes: 1

Fraser Greenlee
Fraser Greenlee

Reputation: 63

I use a wee web app I made to act as a local version of the facebook messenger api server and run user actions.

https://github.com/Fraser-Greenlee/bot_tester

On it you can write a script to define new users and their actions.

Upvotes: 3

Akshay
Akshay

Reputation: 783

One easy way to achieve automated testing for messenger bots atleast is to try to mimic a request coming from FB. You can just log the request you are getting to your bot to find the signature of the request that FB sends. Then you can just pretend to be FB by sending http requests with the same signature. You will also have to add in code to respond to these http requests with your reply instead of just sending the message to FB's send API.

So in node it would be something like

sendMessage(<your reply>);
res.send(<your reply>);

Now you have an automated way of sending and receiving messages which you can use for automated testing.

However I think the bigger challenge is coming up with enough test cases. You need to use a combination of clustering over available data and classification to generate new cases.

I have been working on a tool to make this easy. So if you are interested you can sign up for early access. http://ozz.ai

Upvotes: 0

Matthew Fisher
Matthew Fisher

Reputation: 2336

From the Facebook developers dashboard, select your app and then Roles. From Roles you can add other Facebook users as test users. It was easiest for me to use the users facebook id. Adding by email did not always work for me.

I am not aware of how to access a Facebook bot without a Facebook account. I created several fake accounts and had my friends test the bot. After testing, I deleted the fake accounts.

For more information on setting up a bot see my article Facebook Bots for Fun and Profit

The example bot is DMS Software Bot

The source code is Github fb-robot

Upvotes: 1

Related Questions