def test_mattermost_channel(): with mock.patch.object(sanic.Sanic, "run", fake_sanic_run): # START DOC INCLUDE from rasa.core.channels.mattermost import MattermostInput 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 = MattermostInput( # this is the url of the api for your mattermost instance url="http://chat.example.com/api/v4", # the name of your team for mattermost team="community", # the username of your bot user that will post user="******", # messages pw="password" # the password of your bot user that will post messages ) 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("mattermost_webhook.health").startswith( "/webhooks/mattermost") assert routes_list.get("mattermost_webhook.webhook").startswith( "/webhooks/mattermost/webhook")
def test_mattermost_channel(): # START DOC INCLUDE from rasa.core.channels.mattermost import MattermostInput input_channel = MattermostInput( # this is the url of the api for your mattermost instance url="http://chat.example.com/api/v4", # the name of your team for mattermost team="community", # the username of your bot user that will post user="******", # messages pw="password" # the password of your bot user that will post messages ) 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.get("mattermost_webhook.health").startswith( "/webhooks/mattermost" ) assert routes_list.get("mattermost_webhook.webhook").startswith( "/webhooks/mattermost/webhook" )
def test_mattermost_channel(): # START DOC INCLUDE from rasa.core.channels.mattermost import MattermostInput input_channel = MattermostInput( # this is the url of the api for your mattermost instance url="http://chat.example.com/api/v4", # the bot token of the bot account that will post messages token="xxxxx", # the password of your bot user that will post messages # the webhook-url your bot should listen for messages webhook_url="YOUR_WEBHOOK_URL", ) 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.get("mattermost_webhook.health").startswith( "/webhooks/mattermost" ) assert routes_list.get("mattermost_webhook.webhook").startswith( "/webhooks/mattermost/webhook" )