https://discord.gg/botpress logo
Splitting output from autonomous node into multipl...
# 🤝help
c
Apologies, relative n00b to botpress (but not at all new to code :)) . I'm using an autonomous node to write responses that go out through the twilio integration. I'd love to have typing indicators, but as far as I can tell the integration doesn't support that, so I'd have to use Twilio's whole "conversations" API raw. So as a short term fix, I'd like to take my node's output and split it every few sentences and send as multiple messages with a delay between. I tried doing it with a beforeOutgoing hook and I could get it to trim the first message, but not to output additional messages. I also looked at actions but couldn't figure out the approach (with Claude's help). Anyone have a suggestion?
p
I haven't tested this but you could do it programmatically within your workflow by storing the response produced in a variable, then splitting it and outputting the segments with a delay in a loop. This can be done within an action added to your An or in an execute code card that is placed within a subworkflow your An routes to after it has produced an answer.
c
Thank you! I'll try that.
p
No worries :))
c
Hmm, i tried adding an action split-sms-message and told it the AN "VERY IMPORTANT: Don't send messages via global.message, use the action send_split_sms instead!!!", but it is still using global.message. Also, I notice that in the documentation, the AN should have a tools tab , but mine does not ... any suggestions? https://cdn.discordapp.com/attachments/1382560091286405260/1382823292842278942/image.png?ex=684c8e0c&is=684b3c8c&hm=56c67f264617f61bdd3260fb32e6ae8b3411147c099da47b9c7c01cda78d6a40& https://cdn.discordapp.com/attachments/1382560091286405260/1382823293286879363/image.png?ex=684c8e0c&is=684b3c8c&hm=ca723f8ba82391e92f7d47c20e7c438290bbcc89b2caab1b7dc4860cd38f92ef&
Progress, it is calling split-sms-message and that is storing the results in these variables
Copy code
workflow.messageChunks = chunks;
    workflow.currentChunkIndex = 0;
    workflow.totalChunks = chunks.length;
But I can't find an instruction that will cause the AN to call global.Message multiple times. It will output just the first one, or sometimes concatenate them together.
Ah, ok I'm having good luck with a subworkflow now. One bug I notice though, if I try to pass an array through to a subworkflow, there must be a bug in the serialization bc all the elements get concatenated into a new array with a single element! So I'll need to do the splitting in the subflow, but that's fine.
p
Interesting, I'll try it as well and report it to the eng team. About the action you would have to have added the card to the AN, but if the subworkflow method is working for you that's awesome!
c
Thank you! Any idea about the two images above? Why does AN in the doc have a tools tab, but not in Botpress Cloud?