gupshup-whatsapp-notifications
v1.1.0
Published
This package is use for gupshup whatsapp notifications.
Downloads
6
Maintainers
Readme
gupshup-whatsapp-notifications
Table of Contents
Overview
With the help of this package you can send whatsApp messages from whatsApp business account to many users.
So follow the instructions and enjoy effortless push notifications on app.
Prerequities
- Need to create gupshup account in gupshup.
- Need to create whatsApp business account for live and for sandbox account gupshup provide sender mobile number.
Installation
$ npm install --save gupshup-whatsapp-notifications
Steps
- create account on gupshup.io.
- click on whatsapp tab.
- click on Create App option.
- click on Access API option.
- Insert App name input field and click on submit button.
- Now click on WhatsApp tab. Here you can see your created Apps listing.
- Goto the user profile button and copy the api key.
- Gupshup provide source number(917834811114) for sandbox account. When you go live then you need to create a whatsapp business account.
.
Create User List For Sending Notifications
- Click on App Name and goto app detail page.
- Goto Opt-ins section and expand Onboarding mechanisms.
- Scroll down and scan the QR code for initiating whatsapp chat.
- When we collapse Onboarding mechanisms tab, we can see Opt-in User List. Now we can send message to these specific users only.
- Now come to our package.
After installing package and create an account on gupshup, you need to use whatsappNotifications
method and need to pass in parameter.
Eg:
channel: 'whatsapp',
receiverNumbers: ["opt-in user1", "opt-in user2"],
message: 'Hi Devs...',
senderNumber: `91*******21`,
appName: 'XYZ',
gupshupApiKey: 'ycs******************s9kb'
}
const notificationRes = await whatsappNotifications(notificationInputData);
| Fields | Value | Description |
| :---: | :--- | :--- |
|
channel| whatsapp | Gupshup provide lots of channels like sms, slack, instagram, whatsapp and many more but we use whatsapp |
|
receiverNumbers| ["<opt-in user1>", "<opt-in user2>"] | Provides opt-ins users mobile number in array as a string. |
|
message| 'Hi Devs ...' | Here you can pass message which you want to send our users. |
|
senderNumber| 917834811114 for sandbox account | gupshup provide a sender mobile number for sandbox account when you go live with you **whatsappp App** then you can send message to our users with your own whatsapp business account |
|
appName| string value | App name which you ctreates on **gupshup whatsapp** acount |
|
gupshupApiKey` | string value | It is your gupshup API key |
- The response of this method after successfully execution
Eg:
{
"status": "submitted",
"messageId": "168a9031-cd0b-4ed5-97be-6c333d1b5e39"
}
Note:
- For sandbox account gupshup sends message only one number. If we provide two numbers in an array, api gives success response with messageId and status: submitted but we don't get any message on whatsapp.