Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

bots.business - How to use webhook lib of bots business inside our website?

Hello i want to know can I use webhook lib inside my website because when I change user_id in webhook then it show error

https://api.bots.business/v1/bots/185720/new-webhook?&command=Bok%24%40%25%23%5E&public_user_token=cad2968320d3a8ef7149fb1c9af582aa&user_id=72992

See At The Bottom Of Url. It have user_id parameter when I change it it show error,so can i use webhook lib in our website to easy my devlopment.

question from:https://stackoverflow.com/questions/65895423/how-to-use-webhook-lib-of-bots-business-inside-our-website

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use bot webhook instead user webhook In BJS:

let webhookUrl = Libs.Webhooks.getUrlFor({
  // this command will be runned on webhook
  command: "/onWebhook"
})

Then you can pass user_id in request (web page):

$.ajax({
  type: "POST",
  url: webhookUrl,
  data: { user_id: YOUR_USER_ID },
  success: success,
  dataType: dataType
});

on webhook command (BJS) - run command for user

Bot.run({ command: '/your_user_command', user_id: content.user_id })

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...