@shibacore/apis
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "@shibacore/apis", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
130
README.md
@@ -13,8 +13,8 @@ # Whatsapp Messages API | ||
- [API Reference](#api-reference) | ||
- [WhatsappMessages](#whatsappmessages) | ||
- [Message Types](#message-types) | ||
<!-- | ||
- [WhatsappMessages](#whatsappmessages) - [Message Types](#message-types) | ||
<!-- | ||
- [Error Handling](#error-handling) | ||
---> | ||
---> | ||
- [License](#license) | ||
--- | ||
@@ -27,9 +27,12 @@ | ||
``` | ||
--- | ||
## Features | ||
- Easily send WhatsApp messages using the Graph API. | ||
- Supports text, media (images, videos), templates, interactive components (buttons, lists), and location messages. | ||
- Customizable headers and token types for enhanced flexibility. | ||
- Robust error handling with well-structured responses. | ||
- Easily send WhatsApp messages using the Graph API. | ||
- Supports text, media (images, videos), templates, interactive components (buttons, lists), and location messages. | ||
- Customizable headers and token types for enhanced flexibility. | ||
- Robust error handling with well-structured responses. | ||
--- | ||
@@ -41,5 +44,5 @@ | ||
1. A valid access token for the WhatsApp Business API. | ||
2. Your WhatsApp Business phone number ID. | ||
3. A registered app on the <a href="https://developers.facebook.com/">Facebook Developer Dashboard</a>. | ||
1. A valid access token for the WhatsApp Business API. | ||
2. Your WhatsApp Business phone number ID. | ||
3. A registered app on the <a href="https://developers.facebook.com/" target="_blank">Facebook Developer Dashboard</a>. | ||
@@ -49,12 +52,14 @@ ## Example Usage | ||
import { WhatsappMessages } from "@shibacore/apis"; | ||
const accessToken = "your-access-token"; | ||
const phoneNumberId = "your-phone-number-id"; | ||
const apiVersion = "v20.0"; | ||
const whatsapp = new WhatsappMessages(accessToken, apiVersion, phoneNumberId); | ||
const whatsapp = | ||
new WhatsappMessages(accessToken, apiVersion, phoneNumberId); | ||
// Send a text message | ||
(async () => { | ||
const response = await whatsapp.text("recipient-phone-number", "Hello, World!"); | ||
const response = | ||
await whatsapp.text("recipient-phone-number", "Hello, World!"); | ||
console.log(response); | ||
@@ -64,2 +69,3 @@ })(); | ||
--- | ||
## API Reference | ||
@@ -70,4 +76,4 @@ | ||
Provides methods to send different types of WhatsApp messages. | ||
Constructor | ||
Constructor | ||
constructor( | ||
@@ -84,4 +90,6 @@ access_token: string, | ||
## Message Types | ||
1. Template Messages | ||
1. Template Messages | ||
async template( | ||
@@ -94,40 +102,44 @@ to: string, | ||
- Sends a WhatsApp template message. | ||
Example: | ||
- Sends a WhatsApp template message. | ||
await whatsapp.template("recipient-phone-number", "hello_world", "en_US"); | ||
Example: | ||
2. Text Messages | ||
await whatsapp | ||
.template("recipient-phone-number", "hello_world", "en_US"); | ||
async text( | ||
to: string, | ||
bodyText: string, | ||
preview_url?: boolean | ||
): Promise<WhatsappMessageResponse>; | ||
2. Text Messages | ||
- Sends a plain text message. | ||
async text( | ||
to: string, | ||
bodyText: string, | ||
preview_url?: boolean | ||
): Promise<WhatsappMessageResponse>; | ||
- Sends a plain text message. | ||
Example: | ||
await whatsapp.text("recipient-phone-number", "Hello, this is a message!"); | ||
await whatsapp | ||
.text("recipient-phone-number", "Hello, this is a message!"); | ||
3. Media Messages | ||
3. Media Messages | ||
- Image | ||
async image( | ||
to: string, | ||
imageOption: Media | ||
): Promise<WhatsappMessageResponse>; | ||
async image( | ||
to: string, | ||
imageOption: Media | ||
): Promise<WhatsappMessageResponse>; | ||
- Video | ||
async video( | ||
to: string, | ||
videoOption: Media | ||
): Promise<WhatsappMessageResponse>; | ||
async video( | ||
to: string, | ||
videoOption: Media | ||
): Promise<WhatsappMessageResponse>; | ||
Example: | ||
Example: | ||
await whatsapp.image("recipient-phone-number", { id: "media-id" }); | ||
await whatsapp | ||
.image("recipient-phone-number", { id: "media-id" }); | ||
@@ -158,19 +170,18 @@ <!-- | ||
4. Location Messages | ||
4. Location Messages | ||
async location( | ||
to: string, | ||
location: Location | ||
): Promise<WhatsappMessageResponse>; | ||
async location( | ||
to: string, | ||
location: Location | ||
): Promise<WhatsappMessageResponse>; | ||
Example: | ||
Example: | ||
await whatsapp.location("recipient-phone-number", { | ||
latitude: "12.34", | ||
longitude: "56.78", | ||
name: "Location Name", | ||
address: "123 Address St." | ||
}); | ||
await whatsapp.location("recipient-phone-number", { | ||
latitude: "12.34", | ||
longitude: "56.78", | ||
name: "Location Name", | ||
address: "123 Address St." | ||
}); | ||
--- | ||
@@ -182,4 +193,4 @@ | ||
### Key Features of the Document: | ||
### Key Features of the Document: | ||
1. **Installation & Prerequisites**: Details on setting up the library. | ||
@@ -191,4 +202,3 @@ 2. **Features & Examples**: Highlights key functionalities with code samples. | ||
5. **Contributing & License**: Guidelines for contributing to the project. | ||
---> | ||
This `README.md` ensures clarity and usability for users integrating your library. | ||
---> | ||
This `README.md` ensures clarity and usability for users integrating your library. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31499
194