Nice work.
Apart from a small glitch when it asked me how many people i was asking for, it did quite well (see image).
Question for you:
have you thought of integrating with the Facebook Messenger Send / Receive API? If so , i would love to hear your thoughts.
This is already the case. If you want you, can read a tutorial I wrote on exactly how to build a bot like that with Rails or Sails.
I also do not understand what you mean by stateless. This is built as a REST API, yes. But is it really stateless if the conversation is based on answers to previous questions?
But this minimal codes you speak of, for EACH of the DIFFERENT platforms. Isnât that what I already said Iâm against because the gain isnât that clear or much? How are these minimal codes different from exactly what I donât want to do?
Where will the minimal codes live? Will they be different apps or just one with plenty if statements?
Also, mobile apps, wonât they require client code too?
Please explain how your suggestion has solved the problem.
Will look into this. Thanks!
Thatâs exactly what it is. An API with a vanilla JS client built by @FatherMerry. âUtilizingâ different platforms is the work I donât want to do because I donât see that thereâs a benefit.
I read your article, nice work.
To the questions you raised.
No Sir. REST != stateless. If your current deployment is anything similar to the tutorial. We can assume that the singleton WitExtension is your âbotâ. Your current implementation simply tied a complex knot with the WitExtension, ChatController, WitClient and Model objects. For instance,
def message
param! :message, String, required: true
param! :uid, String, required: true
@conversation = Conversation.find_by_uid(params[:uid]) # you retrieved the current conversation from the db
WitExtension.instance.set_conversation(@conversation) # set the conversation on the Singleton
@message = @conversation.messages.create(
body: message,
kind: "incoming"
) # you then created a new message
WitExtension.instance.client.run_actions(@conversation.uid, params[:message], @conversation.context) # then you stretched deep inside your singleton to extract the client.
puts "SENDING TO WIT #{params[:message]}"
end
And, things like this within the WitExtension.
@conversation.update(context: new_context)
In my opinion, these complexities simply make the bot (WitExtension) to have too much knowledge of not only the model but also the controller and vice versa. I am curious about how you will write test for this implementation.
It could be. Just need to ensure that the bot doesnât retain or manage any data require to generate response between invocations.
You are the best judge of this. But for me, I think the benefit of running this bot on multiple platforms simply outweigh the cost of writing the trivial codes to make it happen (especially in this age of react js|native).
I do hope you realise that my input was made in good faith (Apology for the code review). I wish you the very best.
This is exactly my point. That itâs REST doesnât mean it is stateless. A conversion that is meant to respond based on previous answers isnât stateless by definition.
Sending back the entire message tree to get a new response is as inefficient as it gets. Thatâs delegating storage of the entire conversation to the client and then making the server go through the whole tree every time it gets a message to respond. It makes way more sense to save state server-side.
It is a conversation that responds based on previous answers. It should retain data, that is how conversations work. Context is important.
If you really think so, write the code for all the platforms you want then Iâll give you the API docs. Itâs pretty simple. Just 3 endpoints.
Like you said, itâs trivial codes, so as long as @Nosaaaa doesnât have a problem with it, help yourself.
Lastly,
None of these benefits have been mentioned. If indeed there are benefits, they should have been mentioned by now.
If youâre interested in reaching more people and if youâre interested in serving them more conveniently.
Am chatting up my wife on Messenger and need to book dinner for the both of us, it would be more convenient shooting your bot a message on FB than trying to remember if itâs bot.eatdrinklagos.com or boteatdrinklagos.com
While it sounds more convenient, the assertion is not backed by the nature of our audience.
Okay, so a chat bot on a chat messenger wonât work for your audience? Perhaps thereâs a rule against using Eat.Drink.Lagos outside Eat.Drink.Lagos.
Did i mention; decent effort in between!
I think youâre misunderstanding me. Does it make any sense to have chat bot on Facebook when Facebook is the weakest of the platforms weâre present on?
Twitter would probably make more sense as far as a social media bot goes, but thereâs also a large section of our older audience that arenât present on twitter, or any social media.
The bot, as it is right now, is the middle ground we found.
Am not a big Eat.drink.Lagos reader but if there was a recommender bot that connected the dots for me according to my preferences iâd defly stay connected, as the need arises.
Any reason why you should see this as a solution for just your present audience set? You might be breaking grounds with new pips even on your weakest platform.
The initial goal isnât to reach new people. Itâs to reach an already curated audience. When we successfully do that, we can venture beyond. Launching on a platform we donât have an established presence on is a bit too ambitious for us.