whatsapp-api-js
Advanced tools
Comparing version 0.3.1 to 0.4.0
@@ -8,3 +8,4 @@ const { Contacts } = require('./types/contacts'); | ||
const fetch = require('node-fetch'); | ||
// Bad idea, I don't like var... | ||
if (typeof fetch === "undefined") var fetch = require('node-fetch'); | ||
@@ -11,0 +12,0 @@ /** |
{ | ||
"name": "whatsapp-api-js", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"author": "Secreto31126", | ||
"description": "A Whatsapp Official API helper for Node.js", | ||
"license": "MIT", | ||
"main": "index.js", | ||
@@ -18,15 +20,13 @@ "scripts": { | ||
], | ||
"author": "Secreto31126", | ||
"license": "MIT", | ||
"dependencies": { | ||
"node-fetch": "^2.6.7" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Secreto31126/whatsapp-api-js.git" | ||
}, | ||
"devDependencies": { | ||
"docdash": "^1.2.0", | ||
"jsdoc": "^3.6.10" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/Secreto31126/whatsapp-api-js.git" | ||
} | ||
} |
# whatsapp-api-js | ||
A Whatsapp's Official API helper for Node.js (WIP) | ||
A Whatsapp's Official API helper for Node.js [(and others)](#running-outside-of-nodejs) | ||
@@ -89,2 +89,24 @@ ## Disclaimers | ||
## Running outside of Node.js | ||
The module has a single dependecy, node-fetch, which brings fetch() into Node.js (although it is natively available from v17 and on). | ||
Starting from @0.4.0, the code will check if fetch is available in your enviroment and use it by default, with fallback to node-fetch. | ||
This will allow the same script to be run in differents enviroments, such as a web browsers, Deno, and maybe TypeScript, idk about this last one ¯\\\_(ツ)\_/¯. | ||
Personal suggestion, use [esm.sh](https://esm.sh/) to import the code directly from npm, works flawlessly with Deno. | ||
Some examples: | ||
```js | ||
import { WhatsAppAPI } from "https://esm.sh/whatsapp-api-js"; | ||
const Whatsapp = new WhatsAppAPI("YOUR_TOKEN_HERE"); | ||
``` | ||
```html | ||
<script type="module"> | ||
import { WhatsAppAPI } from "https://esm.sh/whatsapp-api-js"; | ||
const Whatsapp = new WhatsAppAPI("YOUR_TOKEN_HERE"); | ||
<!-- Please, never use your API tokens in a website, use this method wisely --> | ||
</script> | ||
``` | ||
## Documentation | ||
@@ -91,0 +113,0 @@ |
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
60712
1311
0
121
14