def _create_external_channel(channel, port, credentials_file): if credentials_file is None: _raise_missing_credentials_exception(channel) credentials = read_yaml_file(credentials_file) if channel == "facebook": input_blueprint = FacebookInput(credentials.get("verify"), credentials.get("secret"), credentials.get("page-access-token")) elif channel == "slack": input_blueprint = SlackInput(credentials.get("slack_token"), credentials.get("slack_channel")) elif channel == "telegram": input_blueprint = TelegramInput(credentials.get("access_token"), credentials.get("verify"), credentials.get("webhook_url")) elif channel == "mattermost": input_blueprint = MattermostInput(credentials.get("url"), credentials.get("team"), credentials.get("user"), credentials.get("pw")) elif channel == "twilio": input_blueprint = TwilioInput(credentials.get("account_sid"), credentials.get("auth_token"), credentials.get("twilio_number")) else: Exception("This script currently only supports the facebook," " telegram, mattermost and slack connectors.") return HttpInputChannel(port, None, input_blueprint)
def test_facebook_channel(): 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 ) # set serve_forever=True if you want to keep the server running s = agent.handle_channels([input_channel], 5004, serve_forever=False) # END DOC INCLUDE # the above marker marks the end of the code snipped included # in the docs try: assert s.started routes_list = utils.list_routes(s.application) assert routes_list.get("/webhooks/facebook/").startswith( 'fb_webhook.health') assert routes_list.get("/webhooks/facebook/webhook").startswith( 'fb_webhook.webhook') finally: s.stop()
def run_concertbot_online(interpreter, domain_file="domain.yml", training_data_file='data/stories.md'): YOUR_FB_VERIFY = "rasa-bot" YOUR_FB_SECRET = "a9f5370c907e14a983051bd4d266c47b" YOUR_FB_PAGE_ID = "158943344706542" YOUR_FB_PAGE_TOKEN = "EAACZAVkjEPR8BANiwfuKaSVz8yxtLsytuOPvaUzUTlCMAmvuX9TdqGR5P4F1EepBfZCQoKhSR49zM5C9pYX9hmmv3qqiUnRCMDE0eJ1lWRjeqNYTLLA5nbXelSMw0p7neZBSyyIcNHS3e1lbbf2raWPY8IUosJZBMlDLLA7ZBJgTxZAZCvhbO84" 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_tokens={YOUR_FB_PAGE_ID: YOUR_FB_PAGE_TOKEN}, # page ids + tokens you subscribed to debug_mode=True # enable debug mode for underlying fb library ) agent = Agent(domain_file, policies=[MemoizationPolicy(), KerasPolicy()], interpreter=interpreter) #agent.handle_channel() agent.train_online(training_data_file, input_channel=HttpInputChannel(8080, "", input_channel), max_history=2, batch_size=50, epochs=200, max_training_samples=300) return agent
def _create_facebook_channel(channel, port, credentials_file): if credentials_file is None: raise Exception("To use the facebook input channel, you need to " "pass a credentials file using '--credentials'. " "The argument should be a file path pointing to" "a yml file containing the facebook authentication" "information. Details in the docs: " "https://core.rasa.ai/facebook.html") credentials = read_yaml_file(credentials_file) input_blueprint = FacebookInput(credentials.get("verify"), credentials.get("secret"), credentials.get("page-access-token")) return HttpInputChannel(port, None, input_blueprint)
def run_health_bot(serve_forever=True): interpreter = RasaNLUInterpreter('./models/default/healthbot') action_endpoint = EndpointConfig(url='http://localhost:5055/webhook') agent = Agent.load('./models/dialogue', interpreter=interpreter, action_endpoint=action_endpoint) channel = BotServerInputChannel(agent, port=5002) input_channel = FacebookInput( fb_verify=os.environ['FB_VERIFY'], fb_secret=os.environ['FB_BOT_SECRET'], fb_access_token=os.environ['FB_PAGE_ACCESS_TOKEN'] ) agent.handle_channels([channel, input_channel], http_port=5002, serve_forever=True)
def run(): # load your trained agent interpreter = RasaNLUInterpreter('models/nlu/default/current') agent = Agent.load("models/dialogue", interpreter) input_channel = FacebookInput( fb_verify=VERIFY, # you need tell facebook this token, # to confirm your URL fb_secret=SECRET, # your app secret fb_access_token=FACEBOOK_ACCESS_TOKEN # token for the page # you subscribed to ) agent.handle_channel(HttpInputChannel(5001, "", input_channel))
def run(serve_forever=True, port=5002): interpreter = RasaNLUInterpreter( "data/servicing-bot/rasa_servicing_en_nlu/current") agent = Agent.load("data/servicing-bot/dialogue", interpreter=interpreter) input_channel = FacebookInput( fb_verify= "rasa_bot", # you need tell facebook this token, to confirm your URL fb_secret="", # your app secret fb_tokens={"": ""}, # page ids + tokens you subscribed to debug_mode=True # enable debug mode for underlying fb library ) if serve_forever: agent.handle_channel(HttpInputChannel(port, "/app", input_channel)) return agent
def _create_single_channel(channel, credentials): if channel == "facebook": from rasa_core.channels.facebook import FacebookInput return FacebookInput(credentials.get("verify"), credentials.get("secret"), credentials.get("page-access-token")) elif channel == "slack": from rasa_core.channels.slack import SlackInput return SlackInput(credentials.get("slack_token"), credentials.get("slack_channel")) elif channel == "telegram": from rasa_core.channels.telegram import TelegramInput return TelegramInput(credentials.get("access_token"), credentials.get("verify"), credentials.get("webhook_url")) elif channel == "mattermost": from rasa_core.channels.mattermost import MattermostInput return MattermostInput(credentials.get("url"), credentials.get("team"), credentials.get("user"), credentials.get("pw")) elif channel == "twilio": from rasa_core.channels.twilio import TwilioInput return TwilioInput(credentials.get("account_sid"), credentials.get("auth_token"), credentials.get("twilio_number")) elif channel == "botframework": from rasa_core.channels.botframework import BotFrameworkInput return BotFrameworkInput(credentials.get("app_id"), credentials.get("app_password")) elif channel == "rocketchat": from rasa_core.channels.rocketchat import RocketChatInput return RocketChatInput(credentials.get("user"), credentials.get("password"), credentials.get("server_url")) elif channel == "rasa": from rasa_core.channels.rasa_chat import RasaChatInput return RasaChatInput(credentials.get("url"), credentials.get("admin_token")) else: raise Exception("This script currently only supports the " "{} connectors." "".format(", ".join(BUILTIN_CHANNELS)))
def _create_external_channel(channel, port, credentials_file): if credentials_file is None: _raise_missing_credentials_Exception(channel) credentials = read_yaml_file(credentials_file) if channel == "facebook": input_blueprint = FacebookInput(credentials.get("verify"), credentials.get("secret"), credentials.get("page-access-token")) elif channel == "slack": input_blueprint = SlackInput(credentials.get("slack_token"), credentials.get("slack_channel")) else: Exception("This script currently only supports the facebook " "and slack connectors.") return HttpInputChannel(port, None, input_blueprint)
def run(core_dir, nlu_dir): _endpoints = AvailableEndpoints.read_endpoints('endpoints.yml') _interpreter = NaturalLanguageInterpreter.create(nlu_dir) input_channel = FacebookInput( fb_verify=VERIFY, # you need tell facebook this token, to confirm your URL fb_secret=SECRET, # your app secret fb_access_token=FACEBOOK_ACCESS_TOKEN # token for the page you subscribed to ) _agent = load_agent(core_dir, interpreter=_interpreter, endpoints=_endpoints) _agent.handle_channels([input_channel], 5001, serve_forever=True)
def create_input_channel(channel, port, credentials_file): """Instantiate the chosen input channel.""" if channel == "facebook": if credentials_file is None: raise Exception("To use the facebook input channel, you need to " "pass a credentials file using '--credentials'. " "The argument should be a file path pointing to" "a yml file containing the facebook authentication" "information. Details in the docs: " "https://core.rasa.ai/facebook.html") credentials = read_yaml_file(credentials_file) input_blueprint = FacebookInput(credentials.get("verify"), credentials.get("secret"), credentials.get("page-tokens"), True) return HttpInputChannel(port, None, input_blueprint) elif channel == "cmdline": return ConsoleInputChannel() else: raise Exception("Unknown input channel for running main.")
def run_cloud(serve_forever=True): fb_verify = "jarvis_demo_v1" fb_secret = "16de4c12bff8562acdf093063115cf5f" page_id = "253402548804134" fb_access_token = "EAADmdZBDoGiYBADkbun1mP1I3NmWevWW0Mtj5BItxGM2akMdIrqqIGgUIIRvgJMmVQojpRqfZBgWXcpdZBlL6N3woLnISCRD0AuLT76gIbKFZB7HJYdaNxzsyus8MVjlyngTqRonDSdUrcoMYXlflXvSlHvzSsNkXXZB5s9iY5wZDZD" input_channel = FacebookInput( fb_verify= fb_verify, # you need tell facebook this token, to confirm your URL fb_secret=fb_secret, # your app secret fb_access_token=fb_access_token, # token for the page you subscribed to ) interpreter = RasaNLUInterpreter("nlu_model/jarvis_nlu/default/current") agent = Agent.load("nlu_dialogue/models/jarvis_nlu", interpreter=interpreter) if serve_forever: agent.handle_channel(HttpInputChannel(9988, "", input_channel)) return agent
def run_fb_webhook(a, b): print(a) print(b) domain_id = "default" try: agent = agents[domain_id] except: interpreter = RasaNLUInterpreter("{}/{}/nlu/default/current".format( model_folder, domain_id)) agent = Agent.load("{}/{}/dialogue".format(model_folder, domain_id), interpreter=interpreter) agents[domain_id] = agent input_channel = FacebookInput( fb_verify= "intelleibot", # you need tell facebook this token, to confirm your URL fb_secret="f229180435b992cf99b715cc07af5760", # your app secret fb_access_token= "EAAFDolR6SBcBAOTdzAvEDP1VjDIRhaxCc7G6T1GTmIWRmr9vPSKERgiIxeGZBfqx7BRySQ9CVZCQ09BC8SdAXOEpGOnek5I1U2zCeJOUrj7AN2ZBjaxLutVVHJg9OWfVut4uZCL90etmWrAOscr0PjU71mJKImfpgw8wRrEw6wZDZD" # token for the page you subscribed to ) agent.handle_channel(HttpInputChannel(5004, "/intelleibot", input_channel))
def run(serve_forever=True): interpreter = RasaNLUInterpreter("models/nlu/default/current") agent = Agent.load("models/dialogue", interpreter=interpreter) fb_verify = 'fractal' fb_secret = '3db0452e1e4b787d3058e14c624839bc' fb_tokens = { '162871184345992': 'EAAbctRsA3XkBAPeTSd4Q7SKuL0YvINDj30xYquxZC0tJfIZCCzahlDP78D63cTNqpIOQfmeWrnq2B1EFjtf5LHWA7UUQq4imZBSueYtZADcWZARxNWU1kj1SL5dVIn7nxZAj9wZCWmVOZCIkwwU4itzSzu1ZBU41vZC9GJrvbG75i0S5aO7rAYexwt', } input_channel = FacebookInput( fb_verify, fb_secret, fb_tokens, True ) if serve_forever: agent.handle_channel(HttpInputChannel(5000, '/app', input_channel)) return agent
def run(serve_forever=True): AvailableEndpoints = namedtuple('AvailableEndpoints', 'nlg' 'nlu' 'action' 'model') _endpoints = EndpointConfig(url="http://209.97.146.240:5055/webhook") try: _interpreter = RasaNLUInterpreter("models/current/nlu/") # load your trained agent agent = Agent.load("models/current/dialogue", interpreter=_interpreter, action_endpoint=_endpoints) facebook_channel = FacebookInput( fb_verify="rasa-bot", # you need tell facebook this token, to confirm your URL fb_secret="a5fd69f298c42b0d87de817c7071a6a4", # your app secret fb_access_token= "EAABqmImVq5sBAD0A5VeANePSHM7HJkr1rsJKCytYRtNfZBaIProv0jmXmg6xnZALqgkQ1P3Wtw5ZB8tfvrZChE0JCCHI9FhKDkAorhixyh9Vho49ykQQlPV1dJTVS0gP4JRwMC6fsBEFG7LhpXrgsDaqTgaI6bZCxjNG1AzcLoXXRjQgkHMkZAFxLWfLt2LNoZD" # token for the page you subscribed to ) input_channel = TelegramInput( # you get this when setting up a bot access_token="516790963:AAEgzLnFfhmNk48eEwqb1sfFD-HqAThQHT4", # this is your bots username verify="regispucmm_bot", # the url your bot should listen for messages webhook_url="https://www.sysservices.site/webhooks/telegram/webhook" ) # set serve_forever=False if you want to keep the server running s = agent.handle_channels([facebook_channel, input_channel], 5005, serve_forever=True) except: raise Exception("Failed to run")
from flask import Flask from model_manager import ModelManager from rasa_core.channels import HttpInputChannel from rasa_core.channels.facebook import FacebookInput from rasa_core.agent import Agent from rasa_core.interpreter import RasaNLUInterpreter import yaml import os #from rasa_core.utils import EndpointConfig from rasa_core.interpreter import RegexInterpreter interpreter = RasaNLUInterpreter("models/nlu/default/current") agent = Agent.load("models\\dialogue", interpreter= interpreter) # RegexInterpreter()) input_channel = FacebookInput( fb_verify= os.eviron["VERIFY_TOKEN"], fb_secret = os.eviron["FB_SECRET"], fb_access_token = os.eviron["PAGE_ACCESS_TOKEN"]) agent.handle_channel(HttpInputChannel(input_channel))
access_token = "EAAgcdB0uer0BAGtvYoJCytIwOP7ecohZCvfoP0rXSWQHCvtRFGQktnLJkQYwD1ImMgcvwBCgBvVeVgqdPRLVTHeTmZBpxyV4hFn1GY1kkwSLcSDqOUAMSgpyX41VQ9jZBYYztTZAEjI1tQeZCSq22rBDi8PcgX22MfKdYsSqNAAZDZD" from rasa_core.channels import HttpInputChannel 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("dialogue", 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=access_token # token for the page you subscribed to ) agent.handle_channel(HttpInputChannel(5004, "/app", input_channel))
from rasa_core.channels.facebook import FacebookInput from rasa_core.agent import Agent from rasa_core.interpreter import RegexInterpreter from rasa_core.interpreter import RasaNLUInterpreter import yaml from rasa_core.utils import EndpointConfig # load your trained agent nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/weather_nlu') action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter, action_endpoint = action_endpoint) input_channel = FacebookInput( fb_verify="YOUR_FB_VERIFY", # you need tell facebook this token, to confirm your URL fb_secret="c0a30a5fca7df12a0111d6db5f683c79", # your app secret fb_access_token="EAAEvGaFSU1kBAGokBRg30vqZA7wRihjVjv5SeuTZBLbnwXRG8R0r33AZBUT0eCxPtvohLuSqGEaor8b5Eccq5LzzLF071lJjZBf3flZBZAZBH9XOmCiiUpXneTz3FiiTZA1B3dePRxzZBZCtSb7MwbO2lEco5RATZC8psnmZBuK1rbCBsAZDZD" # token for the page you subscribed to ) # set serve_forever=True if you want to keep the server running s = agent.handle_channels([input_channel], 5004, serve_forever=False)
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/dialogue" action_endpoint = EndpointConfig( url="https://bitcoin25bot-actions.herokuapp.com/webhook") agent = Agent.load(MODEL_PATH, interpreter=interpreter) input_channel = FacebookInput( fb_verify="prueba_bot", # you need tell facebook this token, to confirm your URL fb_secret="c0162ecbd77456288d82b02cff91e6ac", # your app secret fb_access_token= "EAAB9nZCZArLUYBAH11pEjGhAvJyZB3VPHfZAlwZAEUcEK6p7SFZCFWzgb2Ld6qpXEkCpqjJ68X5aWbiDpjDQiWg5KbZCgAYZB5uWQBULSsEn46SA2PnuLvVF12K8xJFfoJqn5yPxO4QVOhwOMW8ZAZBGMXrtNZBJY7pFhJZBsg4Ij6pp8QZDZD" # 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)), serve_forever=True)
from rasa_core.channels.facebook import FacebookInput from rasa_core.agent import Agent from rasa_core.interpreter import RasaNLUInterpreter from rasa_core.utils import EndpointConfig import os interpreter = RasaNLUInterpreter("./models/nlu/default/horoscopebot") model_path = "./models/dialogue" action_endpoint = EndpointConfig( "https://horoscopebot007-actions.herokuapp.com/webhook") agent = Agent.load(model_path, interpreter=interpreter) input_channel = FacebookInput(fb_verify="", fb_secret="", fb_access_token="") s = agent.handle_channels([input_channel], int(os.environ.get('PORT', 5004)), serve_forever=True)
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/latest_nlu') core = './models/dialogue' action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") db = MongoTrackerStore(domain="domain.yml", host='mongodb://localhost:27017', db='rasa', username="******", password="******", collection="conversations", event_broker=None) agent = Agent.load(path=core, interpreter=nlu_interpreter, action_endpoint=action_endpoint, tracker_store=db) input_channel = FacebookInput( fb_verify="rasa_check_tarun", # you need tell facebook this token, to confirm your URL fb_secret="54923c84f00be9c37fcdd82caabc03de", # your app secret fb_access_token= "EAAWvofdG0MABAJtr3Rx41WMnqm4q57i2ILNCHzeeCRKrc7h6Xb6DwUhTqXLtdyxZB19SX5joL9gFsWIGZCuAuBkLwj59QxDTCpUGyRdvjEACOsgAdUBZCU3TKVeXn4srZAlDnXFC764MQKeDyZBmpDVvYyWZBMxlVUzIowaIH4VwZDZD" # token for the page you subscribed to ) # set serve_forever=True if you want to keep the server running agent.handle_channels([input_channel], 5004, serve_forever=True)
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/dialogue" print(MODEL_PATH) action_endpoint = EndpointConfig(url="https://horoscopebot1212-actions.herokuapp.com/webhook") print("action_endpoint", action_endpoint) agent = Agent.load(MODEL_PATH, interpreter=interpreter, action_endpoint=action_endpoint) print("agent") input_channel = FacebookInput( fb_verify="my-secret-verify-token", # you need tell facebook this token, to confirm your URL fb_secret="28651269458eef5dd17d6460b506b6d2", # your app secret fb_access_token="EAAJiUznmFTcBANBZBVsVbXvrP994B4njCut72yKo9ZAYch10PFvUJ8syoC3TrZBRoCLjUcjunW6fVqtvQLS7hlzVmlQmJtl92OwZABpUE6DLwYpdko7ZB8LGPpXMFRRy1DFhG1RiVZCPeAzdOxo53dVJrMDlmVUgtg0ZCLb9wLeHAZDZD" # token for the page you subscribed to ) print("here") # set serve_forever=False if you want to keep the server running s = agent.handle_channels([input_channel], int(os.environ.get('PORT', 5004)), serve_forever=True)
from rasa_core.channels.facebook import FacebookInput from rasa_core.interpreter import RasaNLUInterpreter import yaml from rasa_core.utils import EndpointConfig from rasa_core.agent import Agent nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/trendernlu') action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") agent = Agent.load('./models/dialogue', interpreter=nlu_interpreter, action_endpoint=action_endpoint) input_channel = FacebookInput( fb_verify="rasa-bot", # you need tell facebook this token, to confirm your URL fb_secret="0cb73d923e28790ee3e9505b5b384531", # your app secret fb_access_token= "EAAOPBQhIPW0BADBwCXEooAvsKyJFxWM41p5tkB0KlnU7HaiozZAY9ZCL9o4ZAAbBuGLLsIk15NBOJitY16ickxzrnG1fZAeesIH9RJppVcOrLcVqcyNY47nuUZAwgPuXg8ZBJCVVa8yJouKK2ZCXbA0hOZCZCPXrdlEbUlYJnC0FJq8q1k3vwweZAj6hpsdtW6PNwZD" # token for the page you subscribed to ) agent.handle_channels([input_channel], 5004, serve_forever=True)
from rasa_core.channels import HttpInputChannel from rasa_core.channels.facebook import FacebookInput from rasa_core.agent import Agent from rasa_core.interpreter import RasaNLUInterpreter # load your trained agent agent = Agent.load( "models/dialogue", interpreter=RasaNLUInterpreter( model_directory= "C:/Users/Administrator/Desktop/BotV3.0/models/nlu/current", config_file="nlu_model_config.json")) YOUR_FB_VERIFY = "rasa-bot" YOUR_FB_SECRET = "a9f5370c907e14a983051bd4d266c47b" YOUR_FB_PAGE_ID = "158943344706542" YOUR_FB_PAGE_TOKEN = "EAACZAVkjEPR8BANiwfuKaSVz8yxtLsytuOPvaUzUTlCMAmvuX9TdqGR5P4F1EepBfZCQoKhSR49zM5C9pYX9hmmv3qqiUnRCMDE0eJ1lWRjeqNYTLLA5nbXelSMw0p7neZBSyyIcNHS3e1lbbf2raWPY8IUosJZBMlDLLA7ZBJgTxZAZCvhbO84" 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_tokens={YOUR_FB_PAGE_ID: YOUR_FB_PAGE_TOKEN}, # page ids + tokens you subscribed to debug_mode=True # enable debug mode for underlying fb library ) agent.handle_channel(HttpInputChannel(8080, "", input_channel))
from rasa_core.channels.facebook import FacebookInput from rasa_core.agent import Agent from rasa_core.interpreter import RasaNLUInterpreter from rasa_core.utils import EndpointConfig input_channel = FacebookInput( fb_verify="ResBot", # you need tell facebook this token, to confirm your URL fb_secret="f12e71394b4b95e1ae348a8023b72855", # your app secret fb_access_token= "EAAGH6Mgz3VoBAPX7ZCaOvbkNi6Y2qhKJ5ZBycstxdpYnEMr3LfOiqBksrrVNZAZA0FbxwilAyEhJa34EgczzHk9ZCPgC0KjAxroGuxd43xQjtaqv7v7kon1BH3L1S1pgV5G0zBjZCc5F75AS9aLXHpi7vEMUTQnaoHZBZAMe0JyM3eKKsykWfxhL" # token for the page you subscribed to ) nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/ResBot') action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") agent = Agent.load('./models/dialogue', interpreter=nlu_interpreter, action_endpoint=action_endpoint) # set serve_forever=True if you want to keep the server running s = agent.handle_channels([input_channel], 5004, serve_forever=True)
from rasa_core.channels.facebook import FacebookInput from rasa_core.agent import Agent from rasa_core.interpreter import RasaNLUInterpreter from rasa_core.utils import EndpointConfig input_channel = FacebookInput( fb_verify="<any string>", # you need tell facebook this token, to confirm your URL fb_secret="", # your app secret fb_access_token="" # token for the page you subscribed to ) nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/MoodBot') action_endpoint = EndpointConfig(url="http://localhost:5055/webhook") agent = Agent.load('./models/dialogue', interpreter = nlu_interpreter, action_endpoint = action_endpoint) # set serve_forever=True if you want to keep the server running s = agent.handle_channels([input_channel], 5004, serve_forever=True)
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/botneu/") MODEL_PATH = "models/dialogue" print(MODEL_PATH) action_endpoint = EndpointConfig(url="https://doanneu1-actions.herokuapp.com/webhook") print("action_endpoint", action_endpoint) agent = Agent.load(MODEL_PATH, interpreter=interpreter, action_endpoint=action_endpoint) print("agent") input_channel = FacebookInput( fb_verify="chat-bot", # you need tell facebook this token, to confirm your URL fb_secret="06191183529878f9ed1041db6aa07d41", # your app secret fb_access_token="EAAFvxZClqvowBAKnZBZBZAJq6EyY3pISAcOCwG0KQCVeZBPZAa3OAYL9Vvbvyw6dSsa552UDtxCyFu0MlV1hLbTMYGwEDXPEiRqtp1mX8FJN5LZAZB4puN3gmaEZC6vNuqAcnZA4Tc25j2kf0QYXIbb7whbLrZCMEOR0l3AL6tNjhZC6FyLTkYnKvGtt" # token for the page you subscribed to ) print("here") # set serve_forever=False if you want to keep the server running s = agent.handle_channels([input_channel], int(os.environ.get('PORT', 5004)), serve_forever=True)