Socket
Book a DemoInstallSign in
Socket

pinnacle_whatsapp_plugin

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pinnacle_whatsapp_plugin

Pinnacle Whatsapp plugin

latest
npmnpm
Version
1.0.12
Version published
Maintainers
1
Created
Source

Pinnacle whatsapp plugin

Pinnacle Whatsapp plugin official library is useful for sending Outbound messages of all types (text, images, stickers, location pins, contact cards, audio, video, and templates). It can also be used for sending and fetching opt-in requests to the users, as well as the opted-in users list.

Note: API does not support Inbound APIs such as receiving messages from end clients though webhooks.

Installation

   npm install pinnacle_whatsapp_plugin

For API Key You will have to create an account with Pinnacle Teleservices PVT LTD. (https://console.pinbot.ai/) Once you create an account with Pinnacle you can obtain the api key from the email with all the credentials . The same can be used for your specific app or if you are testing with the sandbox application.

const pinnacle= require('pinnacle_whatsapp_plugin');
const apikey  = "<Your API Key>";
Session Messages
1. Send Text Message
{
  "from": "<Your Waba Number>",
  "to": "<Contact Number>",
  "type": "text",
  "message": {
    "text": "<Msg>"
  }
}
2. Send Image Message
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "image",
  "message": {
    "url": "<image url>",
    "caption": "<caption>",
    "filename": "<filename>"
  }
}

3. For Video Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "video",
  "message": {
    "url": "<video url>",
    "caption": "<caption>",
    "filename": "<filename>"
  }
}

4. For Interactive List Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "interactive",
  "message": {
    "interactive": {
      "type": "list",
      "header": {
        "type": "text",
        "text": "Test Header"
      },
      "body": {
        "text": "msgtext"
      },
      "footer": {
        "text": "Test Footer"
      },
      "action": {
        "button": "Button1",
        "sections": [
          {
            "title": "Section1",
            "rows": [
              {
                "id": "1",
                "title": "Row1",
                "description": "Desc1"
              }
            ]
          },
          {
            "title": "Section2",
            "rows": [
              {
                "id": "2",
                "title": "Row2",
                "description": "Desc2"
              }
            ]
          }
        ]
      }
    }
  }
}


5. For Interactive Button Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "interactive",
  "message": {
    "interactive": {
      "type": "button",
      "header": {
        "type": "text",
        "text": "this is header"
      },
      "body": {
        "text": "this is body"
      },
      "footer": {
        "text": "this is footer"
      },
      "action": {
        "buttons": [
          {
            "type": "reply",
            "reply": {
              "id": "1",
              "title": "Button 1"
            }
          },
          {
            "type": "reply",
            "reply": {
              "id": "2",
              "title": "Button 2"
            }
          }
        ]
      }
    }
  }
}

6. For Contact Card Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "contact",
  "message": {
    "contacts": {
      "name": {
        "first_name": "<first_name>",
        "last_name": "<last_name>"
      },
      "phones": [
        {
          "phone": "<phone>",
          "type": "<type>"
        },
        {
          "phone": "<phone>",
          "type": "<type>"
        }
      ]
    }
  }
}

7. For Current Location Messages.
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "location",
  "message": {
    "longitude": "<longitude>",
    "latitude": "<latitude>",
    "name": "<location name>",
    "address": "<loaction address>"
  }
}

7. For Sticker Messages.
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "sticker",
  "message": {
    "url": "<sticker URL>",
    "caption": "Test Sticker",
    "filename": "<filename>"
  }
}
Common Function for calling the Plugin for Sending Message:
   pinnacle.send_session_msg (apikey, Payload).then((repositories) => {
       console.log(repositories)
    });
Template Messages

Note: For Sending template messages we need to initiate the text message After that we can send Template messages such as text, Image, video and document

1. For Sending Template Text Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "template",
  "message": {
    "templateid": "<template id>",
    "placeholders": ["<placeholders>"]
  }
}

2. For Sending Template Image Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "template",
  "message": {
    "templateid": "<template id>",
    "url": "<image url>",
    "placeholders": ["<placeholders>"]
  }
}

3. For Sending Template Video Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "template",
  "message": {
    "templateid": "<template id>",
    "url": "<video url>",
    "placeholders": ["<placeholders>"]
  }
}

4. For Sending Template Document Messages
{
  "from": "<wabanumber>",
  "to": "<contact number>",
  "type": "template",
  "message": {
    "templateid": "<template id>",
    "url": "<document url>",
    "placeholders": ["<placeholders>"]
  }
}


Common Function for calling the Plugin for Sending Message:
   pinnacle.send_template_msg (apikey, Payload).then((repositories) => {
       console.log(repositories)
    });
The following Response Message will be received
{
  "code": "200",
  "status": "SUCCESS",
  "message": "Message Processed Successfully",
  "data": {
    "messageid": "<messageid>"
  }
}

Request Body
PropertyTypeDescriptionRequired
FromstringCustomer's Whatsapp numbertrue
TostringYour Whatsapp business numbertrue
messageMessage PayloadPayload for the sending messagetrue
TypestringTexttrue
Message Payload
PropertyTypeDescriptionRequired
typestringWhatsapp message type( text, audio, video, file, image , location, contact, sticker)true
textstringThe text message to be sent to the customer, in case of type=textfalse
urlstringThe public URL where the file / audio / video attachment to be sent to the customer is hostedfalse
TypestringTexttrue
captionstringAdd caption to media messages, applicable to media `type = imagevideo
longitudenumberTo be sent for type = locationfalse
latitudenumberTo be sent for type = locationfalse
namestringName of the location. Only to be sent for type = locationfalse
addressstringPostal address of the location. Only to be sent for type = location false
contactContact CardContact details to be sent when type = contact false

Pinnacle Support

Call +91 83088 00004, +91 83088 00005 or email at support@pinnacle.in

Keywords

Whatsapp

FAQs

Package last updated on 27 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts