one_msg_waba_sdk v2.39.5
one_msg_waba_sdk
OneMsgWabaSdk - JavaScript client for one_msg_waba_sdk 1MSG.IO is the perfect WhatsApp management tool for your business. With us you get full access to the official Whatsapp API/webhooks.
Every API request must contain an Authorize HTTP header with a token. This is your channel token, which can be found in your channel project on your profile page. Please do not give the token to anyone or post it publicly.
The authorization token must be added to each request in the GET parameter 'token' and always passed to query string (?token={your_token}). Parameters in GET queries pass query string. Parameters in POST requests — through the JSON-encoded request body.
All 'send' methods (except /sendTemplate) will only work when the dialog session with the user is open. Some of our solutions simplify and avoid such limitations, but we urge you to pay more attention to this detail This SDK is automatically generated by the OpenAPI Generator project:
- API version: 2.39.5
- Package version: 2.39.5
- Build package: org.openapitools.codegen.languages.JavascriptClientCodegen
Installation
npm
install it via:
npm install one_msg_waba_sdk --save
Local development
To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json
(and this README). Let's call this JAVASCRIPT_CLIENT_DIR
. Then run:
npm install
Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR
:
npm link
To use the link you just defined in your project, switch to the directory you want to use your one_msg_waba_sdk from, and run:
npm link /path/to/<JAVASCRIPT_CLIENT_DIR>
Finally, you need to build the module:
npm run build
For browser
The library also works in the browser environment via npm and browserify. After following
the above steps with Node.js and installing browserify with npm install -g browserify
,
perform the following (assuming main.js is your entry file):
browserify main.js > bundle.js
Then include bundle.js in the HTML pages.
Webpack Configuration
Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:
module: {
rules: [
{
parser: {
amd: false
}
}
]
}
Vite Configuration
Using Vite you may encounter errors. You might need to add a babel plugin to your
vite.config.js
import babel from 'vite-plugin-babel';
export default defineConfig({
plugins: [babel()],
})
Getting Started
Please follow the installation instruction and execute the following JS code:
import * as OneMsgWabaSdk from 'one_msg_waba_sdk'
let defaultClient = OneMsgWabaSdk.ApiClient.instance;
// Configure path to your instance
defaultClient.basePath = "https://api.1msg.io/YOUR_INSTANCE_NUMBER/";
// Configure API key authorization: token
let token = defaultClient.authentications['token'];
token.apiKey = "YOUR_TOKEN_KEY_FOR_INSTANCE"
let api = new OneMsgWabaSdk.ChannelApi()
api.getMe().then(data=>{
console.log(data)
},err=>{
console.error(err)})
Documentation for API Endpoints
All URIs are relative to https://api.1msg.io/YOUR_INSTANCE_NUMBER
Class | Method | HTTP request | Description |
---|---|---|---|
OneMsgWabaSdk.ChannelApi | getCommerce | GET /commerce | Get Commerce Settings |
OneMsgWabaSdk.ChannelApi | getExtendedStatistics | GET /extendedStatistics | Get Extended Channel statistics |
OneMsgWabaSdk.ChannelApi | getMe | GET /me | Get Profile Info |
OneMsgWabaSdk.ChannelApi | getSettings | GET /settings | Get Settings |
OneMsgWabaSdk.ChannelApi | getStatistics | GET /statistics | Get Channel statistics |
OneMsgWabaSdk.ChannelApi | getStatus | GET /status | Get Status |
OneMsgWabaSdk.ChannelApi | outputIP | GET /outputIP | Get channel server IP |
OneMsgWabaSdk.ChannelApi | setMe | POST /me | Change user info |
OneMsgWabaSdk.ChannelApi | setSettings | POST /settings | Set settings |
OneMsgWabaSdk.MediaApi | uploadMedia | POST /uploadMedia | Upload media & get mediaId |
OneMsgWabaSdk.MessagingApi | messagesList | GET /messages | Get messages list |
OneMsgWabaSdk.MessagingApi | readMessage | POST /readMessage | Mark message as read |
OneMsgWabaSdk.MessagingApi | sendContact | POST /sendContact | Send a Contact |
OneMsgWabaSdk.MessagingApi | sendFile | POST /sendFile | Send a File |
OneMsgWabaSdk.MessagingApi | sendList | POST /sendList | Send List Message |
OneMsgWabaSdk.MessagingApi | sendLocation | POST /sendLocation | Send a Location |
OneMsgWabaSdk.MessagingApi | sendMessage | POST /sendMessage | Send a Message |
OneMsgWabaSdk.ProductsCatalogsApi | sendProduct | POST /sendProduct | Send a Product |
OneMsgWabaSdk.ProductsCatalogsApi | setCommerce | POST /commerce | Set Commerce Settings |
OneMsgWabaSdk.TemplatesApi | addTemplate | POST /addTemplate | Create template |
OneMsgWabaSdk.TemplatesApi | removeTemplate | POST /removeTemplate | Remove template |
OneMsgWabaSdk.TemplatesApi | sendTemplate | POST /sendTemplate | Send Template Message |
OneMsgWabaSdk.TemplatesApi | templatesList | GET /templates | Get templates list |
OneMsgWabaSdk.WebhooksApi | ackHookInfo | GET /hookInfo | Check ACKs |
OneMsgWabaSdk.WebhooksApi | setWebhook | POST /webhook | Set webhook |
Documentation for Models
- OneMsgWabaSdk.Ack
- OneMsgWabaSdk.AddTemplateRequest
- OneMsgWabaSdk.ChannelExtendedStatistics
- OneMsgWabaSdk.ChannelExtendedStatisticsInner
- OneMsgWabaSdk.ChannelStatistics
- OneMsgWabaSdk.ChannelStatus
- OneMsgWabaSdk.ChatIdProp
- OneMsgWabaSdk.Commerce
- OneMsgWabaSdk.CommerceParams
- OneMsgWabaSdk.Contacts
- OneMsgWabaSdk.ContactsContactsInner
- OneMsgWabaSdk.ContactsRequest
- OneMsgWabaSdk.GetAckInfo
- OneMsgWabaSdk.GetAckInfoHooksInner
- OneMsgWabaSdk.GetCommerce
- OneMsgWabaSdk.GetCommerceInner
- OneMsgWabaSdk.GetIP
- OneMsgWabaSdk.GetMe
- OneMsgWabaSdk.GetMe401Response
- OneMsgWabaSdk.GetMessages
- OneMsgWabaSdk.GetMessagesMessagesInner
- OneMsgWabaSdk.GetTemplates
- OneMsgWabaSdk.GetTemplatesTemplatesInner
- OneMsgWabaSdk.MeComponents
- OneMsgWabaSdk.MediaId
- OneMsgWabaSdk.Message
- OneMsgWabaSdk.MessageIdProp
- OneMsgWabaSdk.PhoneProp
- OneMsgWabaSdk.ReadMessageRequest
- OneMsgWabaSdk.RemoveTemplateRequest
- OneMsgWabaSdk.SendContactRequest
- OneMsgWabaSdk.SendFileRequest
- OneMsgWabaSdk.SendListRequest
- OneMsgWabaSdk.SendListRequestAllOfRows
- OneMsgWabaSdk.SendListRequestAllOfSections
- OneMsgWabaSdk.SendLocationRequest
- OneMsgWabaSdk.SendMessageRequest
- OneMsgWabaSdk.SendMessageStatus
- OneMsgWabaSdk.SendProductRequest
- OneMsgWabaSdk.SendProductRequestAllOfAction
- OneMsgWabaSdk.SendProductRequestAllOfActionProductItems
- OneMsgWabaSdk.SendProductRequestAllOfActionSections
- OneMsgWabaSdk.SendTemplateRequest
- OneMsgWabaSdk.SendTemplateRequestAllOfCurrency
- OneMsgWabaSdk.SendTemplateRequestAllOfDateTime
- OneMsgWabaSdk.SendTemplateRequestAllOfDateTimeComponent
- OneMsgWabaSdk.SendTemplateRequestAllOfDateTimeUnixEpoch
- OneMsgWabaSdk.SendTemplateRequestAllOfLanguage
- OneMsgWabaSdk.SendTemplateRequestAllOfParams
- OneMsgWabaSdk.SetCommerce
- OneMsgWabaSdk.SetMe
- OneMsgWabaSdk.SetMeRequest
- OneMsgWabaSdk.SetSettings200Response
- OneMsgWabaSdk.SetSettings200ResponseAllOfUpdate
- OneMsgWabaSdk.SetWebhookStatus
- OneMsgWabaSdk.Settings
- OneMsgWabaSdk.TemplateCategoryProp
- OneMsgWabaSdk.TemplateComponentsProp
- OneMsgWabaSdk.TemplateComponentsPropInner
- OneMsgWabaSdk.TemplateComponentsPropInnerButtonsInner
- OneMsgWabaSdk.TemplateLanguageProp
- OneMsgWabaSdk.TemplateNamespaceField
- OneMsgWabaSdk.UploadMedia
- OneMsgWabaSdk.WebhookUrl
Documentation for Authorization
Authentication schemes defined for the API:
token
- Type: API key
- API key parameter name: token
- Location: URL query string