You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
I have this code that asks a question then when the response is received, it goes to another question thread.
`await bot.changeContext(message.reference);
const convo = new BotkitConversation('register', bot.controller);
convo.ask('Please write the POS ID that you would like to register', async (response, mConvo, mBot) => {
convo.addAction('askUsername');
}, 'posId');
convo.addQuestion('What is your username ?', async (response, mConvo, mBot) => {
mConvo.stop();
}, 'username', 'askUsername');
There are a lot of issues with the sample code you posted.
You should define the structure of your dialog ONCE and add it to the bot when it first boots up.
You cannot make changes to the structure of the conversation when it is active -- calling convo.addAction inside the ask callback will cause issues
The send middleware will be seeing the message in its "botkit" form before it is translated into a Facebook API call where the recipient value is mixed in.
Thanks Ben, I'm new to Version 4, so I appreciate your feedback.
I use the send middleware to save the messages that are sent to the users from the bot, and i include the text of the message + the recipient id for logging and debugging purposes, so it's crucial for me to have the recipient id there.
I hope this makes the problem clearer, I haven't been able to solve this yet.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I think that this issue is likely the same as #2030 and also my latest #2062, as it concerns botkit middleware and not Facebook in particular. In summary: no information about the recipient is available within the send middleware as part of the message, if the message is part of an ongoing convo. Unfortunately, this is really crucial information for a bot application :-( (e.g. it's impossible to log properly without the recipient/user id).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hey all,
I have this code that asks a question then when the response is received, it goes to another question thread.
`await bot.changeContext(message.reference);
const convo = new BotkitConversation('register', bot.controller);
convo.ask('Please write the POS ID that you would like to register', async (response, mConvo, mBot) => {
convo.addAction('askUsername');
}, 'posId');
convo.addQuestion('What is your username ?', async (response, mConvo, mBot) => {
mConvo.stop();
}, 'username', 'askUsername');
bot.controller.addDialog(convo);
await bot.beginDialog(convo.id);`
This part works fine.
but in the send middleware:
controller.middleware.send.use(async (bot, message, next) => { console.log(message); });
The problem is,
This message does not have the "recipient" field or any field that contains data about the channel, sender or receiver.
When using bot.reply(), the message in send middleware contains the "recipient" field which has that facebook id of the user.
Thanks
The text was updated successfully, but these errors were encountered: