def test_facebook_channel(): with mock.patch.object(sanic.Sanic, "run", fake_sanic_run): # START DOC INCLUDE from rasa.core.channels.facebook import FacebookInput from rasa.core.agent import Agent from rasa.core.interpreter import RegexInterpreter # load your trained agent agent = Agent.load(MODEL_PATH, interpreter=RegexInterpreter()) input_channel = FacebookInput( fb_verify="YOUR_FB_VERIFY", # you need tell facebook this token, to confirm your URL fb_secret="YOUR_FB_SECRET", # your app secret fb_access_token="YOUR_FB_PAGE_ACCESS_TOKEN" # token for the page you subscribed to ) s = agent.handle_channels([input_channel], 5004) # END DOC INCLUDE # the above marker marks the end of the code snipped included # in the docs routes_list = utils.list_routes(s) assert routes_list.get("fb_webhook.health").startswith( "/webhooks/facebook") assert routes_list.get("fb_webhook.webhook").startswith( "/webhooks/facebook/webhook")
def test_facebook_channel(): from rasa.core.channels.facebook import FacebookInput input_channel = FacebookInput( fb_verify="YOUR_FB_VERIFY", # you need tell facebook this token, to confirm your URL fb_secret="YOUR_FB_SECRET", # your app secret fb_access_token="YOUR_FB_PAGE_ACCESS_TOKEN" # token for the page you subscribed to ) s = run.configure_app([input_channel], port=5004) routes_list = utils.list_routes(s) assert routes_list["fb_webhook.health"].startswith("/webhooks/facebook") assert routes_list["fb_webhook.webhook"].startswith("/webhooks/facebook/webhook")
def test_facebook_channel(): # START DOC INCLUDE from rasa.core.channels.facebook import FacebookInput input_channel = FacebookInput( fb_verify="YOUR_FB_VERIFY", # you need tell facebook this token, to confirm your URL fb_secret="YOUR_FB_SECRET", # your app secret fb_access_token="YOUR_FB_PAGE_ACCESS_TOKEN" # token for the page you subscribed to ) s = rasa.core.run.configure_app([input_channel], port=5004) # END DOC INCLUDE # the above marker marks the end of the code snipped included # in the docs routes_list = utils.list_routes(s) assert routes_list["fb_webhook.health"].startswith("/webhooks/facebook") assert routes_list["fb_webhook.webhook"].startswith("/webhooks/facebook/webhook")
# -*- coding: utf-8 -*- """ Created on Thu May 7 11:40:40 2020 @author: hung.td170078 """ from rasa.core.channels.facebook import FacebookInput from rasa.core.agent import Agent from rasa.core.interpreter import RasaNLUInterpreter import os from rasa.core.utils import EndpointConfig # load your trained agent interpreter = RasaNLUInterpreter("models/nlu/") MODEL_PATH = "models/20200521-171510.tar.gz" action_endpoint = EndpointConfig(url="https://lunachatbot-prj2-actions.herokuapp.com/webhook") agent = Agent.load(MODEL_PATH, interpreter=interpreter, action_endpoint=action_endpoint) input_channel = FacebookInput( fb_verify="jackfrost", # you need tell facebook this token, to confirm your URL fb_secret="4ad8cdf285aeef2548b23c130cd6f56c", # your app secret fb_access_token="EAASmSto8E9IBANlkhOp0pcoMXdWJanepzZBBAmQ9ZBsm07CYlwG7qqIgb5ccUvGWGdZCJRS6U72W4j1MctoZBUhACihyuAhEUp5wAxsPBSkiMXADiKHWPA8LPErMz5WywZBWg043qnsBJZBr42HpPdPxcoAnWYJKQfc2DNANgERwZDZD" # token for the page you subscribed to ) # set serve_forever=False if you want to keep the server running s = agent.handle_channels([input_channel], int(os.environ.get('PORT',5004)))
from rasa.core.channels.facebook import FacebookInput from rasa.core.agent import Agent from rasa.core.interpreter import RasaNLUInterpreter import os from rasa.core.utils import EndpointConfig # load your trained agent #interpreter = RasaNLUInterpreter("models/nlu/default/horoscopebot/") MODEL_PATH = "./models/20200820-074654.tar.gz" action_end_point = EndpointConfig(url="http://localhost:5055/webhook") agent = Agent.load(MODEL_PATH, action_endpoint=action_end_point) input_channel = FacebookInput( fb_verify="asdf;lkj", # you need tell facebook this token, to confirm your URL fb_secret="99deccebeaed0c908a974c12f901176d", # your app secret fb_access_token= "EAARixYEP3lQBAEe6DUj8snZBEcN2EHS1xeN5SEtP6Y0ZBDdKMdFcaXNg8tbffmEx5ZALgWEVzCFhILiIrlKISFiEZAGCJu3SMEnN8YExcyO0tNRwQuDru9BoikZAdDq1qvncnfYl5LWhIYAoEP4dXD7cOJ1tfE9ahY2cqE5JM6IizDCFttoVq" ) s = agent.handle_channels([input_channel], int(os.environ.get('PORT', 5004)))