Stella is a highly customizable bot building tool and provides the flexibility to build a personalized chatbot flow for any business use case. You can make use of actions
in Stella, which includes both Pre-actions
and Post-actions
.
Please refer to the sample code below on fetching data from JSON placeholder.
The sample code logic is as follows:
this.member
with this.lodash.set
this.member
through the use of resolvereturn new Promise((resolve) => {
const userId = this.messageEvent.data.text
const userInfo = fetch(`https:\/\/jsonplaceholder.typicode.com/users/${userId}`)
.then(res => res.json())
this.lodash.set(this.member, "botMeta.tempData.userInfo", userInfo)
resolve({
member: this.member
})
})
For later usage, you can access the to-dos data with this.lodash.get(this.member, "botMeta.tempData.userInfo", null)
.