Skip to main content

Hi, I am creating a zap that will broadcast to all subscribed users on telegram. it worked on my vscode but the zap does not produce anything, is there anything wrong with my codes?

 

let token = TOKEN;

await fetch(`https://stickybot-server.glitch.me/user/getAllUsers`)
  .then(res => res.json())
  .then(json => 
      {
      json.forEach(async user => {
          let data = {
              chat_id : user.userId.toString(), 
              text : "text"
          }
          await fetch(`https://api.telegram.org/bot${token}/sendMessage`,
              {
              method: 'POST',
              body: JSON.stringify(data),
              headers: {
                  'Content-Type': 'application/json'
              }
          })
      })
  })

Hi @yeqmxplc!

 

Did @Metagrate_John4man suggestion help here? We’d love to know if sending your credentials to the url did the trick :slight_smile:


Hi @yeqmxplc --

Is this a complete snippet of your code? If so, I presume you need credentials for your call to https://stickybot-server.glitch.me/user/getAllUsers. Return those results to Zapier and confirm you’re getting the expected response before making the remaining calls.

 


Hi @yeqmxplc! When you say that the Zap doesn’t produce anything, could you elaborate?

Is the hook not being sent to Telegram? Does it go but then hit an error message (if so, what’s the error?), or is it being received ok, but nothing is being sent? Thanks for helping us to understand the issue 🙂