Closed ahetawal-p closed 6 months ago
Hi @ahetawal-p, there's 2 approaches to this:
1) Use params.injectMessage
multiple times to send each detail as a different message and hence distinguishing between lines.
2) Use the render
attribute to include your own custom react component - which means you can write a component that handles parsing/formatting however you wish.
Thanks @tjtanjin
Could you provide me an example of how to use the render
attribute, when using the api response.
Here is the step I use:
allIncidents: {
message: async (_params: Params) => {
const data = await makeApiCall('allIncidents')
return data
},
transition: { duration: 0 },
path: 'repeat',
},
@ahetawal-p The render component example gives you an idea of how it can be done. See if it's helpful for you.
@tjtanjin i did look at it, i guess my question is how do i pass the response from
const data = await makeApiCall('allIncidents')
return data
To pass to render function so it can render the data with the <pre></pre>
tags...
@ahetawal-p You can refer to the table listing the attributes. For your case, since render
takes in a function as well, you would make your API call within the render
attribute rather than within message
. That way there's no need to consider passing information.
Hey @ahetawal-p! May I assume this is resolved?
Yes, thank you
Hello, My api returns some content which is formatted with new lines and some lists. Something like this:
How can I suppose this in the message rendering when a bot responds ?