Skip to content

Commit

Permalink
Updated Code
Browse files Browse the repository at this point in the history
  • Loading branch information
DaggieBlanqx committed Jun 20, 2022
1 parent d311553 commit 2c66c19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,16 @@
});
```

> Quick Question:
> Quick Question:
- How does a recipient phone number look like?

> Quick Answer:
- A recipient phone number is the international phone number of the recipient without the '+' prefix.
> Quick Answer:
- A recipient phone number is the international phone number of the recipient without the '+' prefix.
- For example, where a Kenyan phone number is '+254712345678' we would send the message to a recipientNumber 254712345678.
- For a phone number +15550253483 we would send the message to a recipientNumber 15550253483.
- For a phone number +15550253483 we would send the message to a recipientNumber 15550253483.
- For an US phone number +1 555-555-5555 we would send the message to a recipientNumber 5555555555.

Makes sense?



Makes sense?

- Send a Geo-location message to a recipient:

Expand Down Expand Up @@ -200,8 +197,8 @@
- The title of the list must be between 1 and 24 characters long.
- The id of the list must be between 1 and 200 characters long.


### Notes:

- This package is in active development.
- This means new features are added regularly.
- Incase your favorite feature is missing, you can always bump a version backwards or create a pull request which will be reviewed and merged into the next release.
Expand Down
14 changes: 9 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,18 +516,22 @@ class WhatsappCloud {
};

if (file_path) {
if(!file_name) {
throw new Error('"file_name" is required alongside "file_path" in uploading && attaching a document');
};
if (!file_name) {
throw new Error(
'"file_name" is required alongside "file_path" in uploading && attaching a document'
);
}
let uploadedFile = await this._uploadMedia({
file_path,
file_name,
});
body['document']['id'] = uploadedFile.media_id;
body['document']['filename'] = uploadedFile.file_name || '';
} else {
if(!caption){
throw new Error('A "caption" is required alongside "url" in attaching a document.');
if (!caption) {
throw new Error(
'A "caption" is required alongside "url" in attaching a document.'
);
}
body['document']['link'] = url;
}
Expand Down

0 comments on commit 2c66c19

Please sign in to comment.