Subscription message


#1

Hi guys, I’m using BPX 10.51.4 and I’m implementing sending subscription messages in messenger.
I have already solved the format of this type of message in the messenger module and I incorporated botpress-scheduler so that it can send it daily.

What I need is to invoke in the action of the scheduler a function / action defined by me. How can I do it?

Where can I put it and how do I invoke it from the scheduler?

Thank you!


#2

@lmoralejo, you may find https://botpress.io/docs/10.50/recipes/scheduling/ docs helpful.


#3

Thanks @alex ! I understood that. My question is about whether I can get that snippet as a function. For example, somewhere define the sendSusbcriptions function with all the logic and in the snipet have a single line that is:
sendsubscriptions ();

If so, where should I declare the function and how do I invoke it from the action?


#4

@lmoralejo, since bp-instance is available within the snippet, you can define that function somewhere like this:

bp.sendsubscriptions = () => {
  // do smth
}

#5

@alex Thanks! That works well