Telegram redirect after payment, two scenarios

I have 2 scenarios. I created a Telegram bot. A user pays for its use. I’ve enabled API integration and the lava.top payment system. The user clicks the Pay button, and a payment link from this payment system opens. The payment is successful, but then the rest of the scenario doesn’t launch. There’s no redirect from the payment page back to Telegram.

In the second scenario, the webhook accepts the payment status. I’ve attached the Telegram module, but it’s not working because I can’t add a chat id. It’s not in the mapping.

I’m desperate. I’ve tried so many things, and nothing works. How do I redirect back to Telegram? Or how do I add a chat id in the second scenario from the first scenario? Can you help me, please

1 Like

Hi @Olena_Soloviova Welcome to the community!

To get chat id you can redirect them to a telegram bot again after payment. So you can get chat id to add them to specific chats channels or groups. You need to use Watch Updates trigger module to look for those messages and need to store them to make sure you invite users who initiated chat and completed payment.

I hope this helps!

Best,
@Prem_Patel

Thank you! Unfortunately I dont’t have module Watch Updates. Is it possible to replace it? Will it conflict with the webhook?

1 Like

Can you share your webhook payload?

Webhooks don’t share data. I tried storing the chat ID data in the Data Store, but it doesn’t show up in the second scenario.

Webhook 1 from payment system lava.top, second webhook from first scenario.

I thought the payment system’s webhook would send a message to Telegram about the payment in the second scenario. And after that, I could launch the first scenario.

1 Like

From 1st scenario, are you sending data to another scenario? if that’s the case add datastore id in the payload for the webhook, so in 2nd scenario you can search for that datastore record.

Thank you for your help! You really helped me. It turns out I had the wrong key in the Data Store. I created one key and added one common Data Store to both scenarios. In the first scenario, I saved the telegram chat ID in DS and added it to the second scenario. Now everything works, but a new problem has appeared. I can’t run the scenario after payment. It ran once. I think the problem is that sometimes there is data in the payload, sometimes not. It updates slowly. Sometimes the next scenario is triggered, sometimes two branches are triggered. One branch after /start and the second after payment. What could be the problem here?

1 Like

Glad that it helped!

For your latest issue, without looking at the logs and understanding the scenario setup, we can’t help!

I found a bug and fixed it. I had two branches triggering because there was duplicate data from the payload in the Data Store. I removed the duplicate chips from the payload in the Data Store Add/Replace records. I also added an HTTP module to the second scenario so it would pass the data to the first scenario and trigger the correct branch.

Thank you for help!

2 Likes