rasa-alice
Rasa Connector for Yandex Dialogs.
Installing
$ pip install rasa-alice
Usage
URL: /webhooks/alice/webhook
credentials.yml
rasa_alice.AliceInput:
domain.yml
templates:
utter_text:
- text: "ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΡΠΎ ΠΌΡ, Ρ
ΠΎΡΠΎΠ²ΠΎΠ΄ΠΎΠ²Π΅Π΄Ρ."
utter_text_custom:
- custom:
text: "ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΡΠΎ ΠΌΡ, Ρ
ΠΎΡΠΎΠ²ΠΎΠ΄ΠΎΠ²Π΅Π΄Ρ."
tts: "ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΡΠΎ ΠΌΡ, Ρ
ΠΎΡΠΎΠ²+ΠΎΠ΄ΠΎ Π²+Π΅Π΄Ρ."
end_session: true # false by default
utter_text_with_buttons:
- text: 'Hello'
buttons:
- title: 'ΠΠ°Π΄ΠΏΠΈΡΡ Π½Π° ΠΊΠ½ΠΎΠΏΠΊΠ΅'
url: 'https://example.com/'
hide: true
utter_big_image:
- custom:
text: "ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΡΠΎ ΠΌΡ, Ρ
ΠΎΡΠΎΠ²ΠΎΠ΄ΠΎΠ²Π΅Π΄Ρ."
card:
type: "BigImage"
image_id: "1027858/46r960da47f60207e924"
title: "ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ Π΄Π»Ρ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ"
description: "ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ."
button:
text: "ΠΠ°Π΄ΠΏΠΈΡΡ Π½Π° ΠΊΠ½ΠΎΠΏΠΊΠ΅"
url: "http://example.com/"
utter_items_list:
- custom:
text: "ΠΠ΄ΡΠ°Π²ΡΡΠ²ΡΠΉΡΠ΅! ΠΡΠΎ ΠΌΡ, Ρ
ΠΎΡΠΎΠ²ΠΎΠ΄ΠΎΠ²Π΅Π΄Ρ."
card:
type: "ItemsList"
header:
text: "ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ Π³Π°Π»Π΅ΡΠ΅ΠΈ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠΉ"
items:
- image_id: "<image_id>"
title: "ΠΠ°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ Π΄Π»Ρ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ."
description: "ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ."
button:
text: "ΠΠ°Π΄ΠΏΠΈΡΡ Π½Π° ΠΊΠ½ΠΎΠΏΠΊΠ΅"
url: "http://example.com/"
The original request is stored in metadata, you can use it in custom actions:
class ActionHelloWorld(Action):
def name(self) -> Text:
return "action_hello_world"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
events = tracker.current_state()['events']
user_events = []
for e in events:
if e['event'] == 'user':
user_events.append(e)
original_request = user_events[-1]['metadata']
payload = original_request['request']['payload']