Closed pavei closed 6 years ago
All of those libraries should track both of them for you, if not, you can report it as bug.
We use axios interceptor under the hood to catch outgoing messages:
@chentsulin axios.interceptors.response.use(response) is there a way to get page id or get the bot context?
I want to build an ID with sender-id and recipent-id
Here is what i did:
module.exports = function setInterceptors(bot, botimize) {
const {connector: {client: {accessToken, axios}}} = bot;
// Add a response interceptor
axios.interceptors.response.use(response => {
const {config} = response;
if (config.data) {
bot.sessions.read("messenger:" + JSON.parse(config.data).recipient.id).then(context => {
let obj = {
conversationId: context._state.fbPageId + "-"+JSON.parse(config.data).recipient.id,
jsonMessage: {text: JSON.parse(config.data).message},
type: "send",
}
console.log(obj);
}).catch(error => {
console.log(error);
})
}
return response;
});
}
EDIT:
But it does not work... I use the same USER to access to different pages, the context._state still the first state.
You may not need conversation id, because Page-Scoped ID already be a unique id between user and page.
@chentsulin it was the error about setState #162 .. Thanks
Hi,
I saw the exemples with (botanalytics, dashbot etc..) but they only track what User Send. I want to track what bot send to user. How can i do this?
Thanks