Romani Core, v1.0
Posted on

Extendable web service for a running of conversations via Instagram* Direct.
Major release. Implement the conversation business logic.
* Запрещена в России / Banned in Russia.
Change Log
- Extend the conversation data model:
- Extend the database schema of the conversation data model.
- Describe the conversation data model in the code.
- Support an update of a conversation in a database.
- Implement the conversation business logic:
- Support an iteration over conversations in a database.
- Implement one step of a conversation.
- Implement a loop of a conversation.
Features
- working mode:
- run as a web service;
- control via the RESTful API;
- RESTful API commands:
- start a conversation with a specified user:
- collect users in a database (SQLite);
- protect against duplicate users;
- start a conversation with a specified user:
- Romani Gate commands:
- send a text message to a specified user;
- send a link message to a specified user;
- send a photo message to a specified user;
- read an info of a specified user;
- read a history of a thread with a specified user:
- automatic detect a thread ID;
- support a pagination of a history;
- restrict a history by a specified message ID;
- Romani Mind commands:
- handle a part of a history of a thread with an user;
- conversation business logic:
- for each user in a database repeat following steps:
- get an input data:
- via Romani Gate:
- user info;
- new user messages;
- from the database:
- auxiliary data;
- via Romani Gate:
- process the gotten data via Romani Mind;
- save the auxiliary data from Romani Mind to the database;
- send a response from Romani Mind to the user via Romani Gate.
- get an input data:
- for each user in a database repeat following steps:
Architecture
UML component diagram in the PlantUML language:
@startuml
skinparam componentStyle uml2
cloud {
() "Romani Gate API" as RomaniGateAPI
}
cloud {
() "Romani Mind API" as RomaniMindAPI
}
package "Romani Core" {
database "SQLite" {
[Conversations]
}
[Web Server] -up- API
[Web Server] .down.> [Conversations] : add an user
[Conversation Loop] .up.> [Conversations] : scan conversations
[Conversation Loop] .up.> [Conversations] : update conversation
[Conversation Loop] .down.> RomaniGateAPI : get_user
[Conversation Loop] .down.> RomaniGateAPI : get_thread
[Conversation Loop] .down.> RomaniGateAPI : get_thread_history
[Conversation Loop] .down.> RomaniGateAPI : send_message
[Conversation Loop] .down.> RomaniGateAPI : send_photo
[Conversation Loop] .down.> RomaniMindAPI : history
}
[Romani Bot] .down.> API : POST /conversations
@enduml
Rendered UML component diagram:
Screenshots

Copyrights
- road photo — Pixabay License, Copyright © 2013 Larisa-K, https://pixabay.com/en/road-asphalt-space-sky-clouds-220058/.