Create a new directory, and create a new file .denoflare in that directory. Put the following contents in the file:
Note: The “$schema” key in the following JSON code specifies a fixed version in its URL (“v0.5.12”). At the time of writing, this was the latest version available. You should update them to the newest version.
Make sure to replace YOUR_ACCOUNT_ID, YOUR_API_TOKEN, and YOUR_BOT_TOKEN appropriately. When creating your API token, you can choose the Edit Cloudflare Workers preset from the pre-configured permissions.
The output of the above command will provide you with the host the worker is running on. Watch out for a line containing something like <MY_BOT>.<MY_SUBDOMAIN>.workers.dev. That’s the host where your bot is waiting to be called.
For testing and debugging purposes, you can run a local or remote development server before deploying your bot to production. Simply run the following command:
denoflare serve my-bot
Once the development server has started, you can test your bot by sending sample updates to it using tools like curl, Insomnia, or Postman. Refer to here for update examples and here for more information on the update structure.