Hello Team,
I am trying the same thing attempted above i.e. emailing the conversation.
I have tried the following code as mentioned in the post above. But it is not working, I get an error. Please let me know the mistake I am making.
If I create the same URL manually i.e. picking user Id and conversation ID and typing it in the browser, I can see the data i.e JSON file. But I am unable to access the same using the axios.get function. Is the URL creation a problem???
Thanks in advance.
Regards
Vishwa
//------------------------------------------------------------------
const axios = require(‘axios’)
/**
-
@title Modifled call of the Github API to fetch Botpress repositories
-
@author Botpress, Inc.
*/
const callApiNew = async () => {
// We call the API
uId = event.target
cId = event.threadId
const { data } = await axios.get(‘http://localhost:3000/api/v1/bots/maria/mod/channel-web/conversations/{uId}/{cId}/download/txt’)
// Please note that there is a dollar ($$) while using {uId} and {cId} while creating the URL. i.e.: {uId}, {cId}.
// We assign the response to the session variable so we can use it later
session.response = data
}
// Actions are async, so make sure to return a promise
return callApiNew()