0

1.I have to use the same function like manychat's smart delay. But I write the chatbot code with fbmq, which is used the python language. so In this code, I want to delay 10 secs, and then use page_send(response.id,"link") to the users. How should I code that?

@page.callback(['test4'])   
def callback_clicked_button(payload, event):
    recipient_id = event.sender_id
    page.send(recipient_id, "Before 10 secs" )

time_sleep(10)
     page.send(recipient_id, "link" )

there's no response!

halfelf
  • 9,737
  • 13
  • 54
  • 63
Joan
  • 3
  • 2
  • Does this answer your question? [How can I make a time delay in Python?](https://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python) – aakanksha khandelwal Nov 21 '19 at 07:01

1 Answers1

0

This python time has sleep fucntion which will help in delay.

import time
time.sleep(5) # 5 stand for seconds 

Your code will go like this

import time

@page.callback(['test4'])   
def callback_clicked_button(payload, event):
    recipient_id = event.sender_id
    page.send(recipient_id, "Before 10 secs" )
    time.sleep(10)
    #time_sleep(10) 
    page.send(recipient_id, "link" )
Avi
  • 1,424
  • 1
  • 11
  • 32