title: Viber setWebhook failed with error - The "data" argument must be one of type string, TypedArray, or DataView. Received type object
body: <p>Trying to setup a viber webhook. I already have an express server setup. So I just add the bot as middleware. Everything is find and the server is up and running.</p>
  <p>Once called <code>bot.setWebhook(process.env.VB_WEBHOOK_URL)</code>, it throws error saying --&gt; <code>The &quot;data&quot; argument must be one of type string, TypedArray, or DataView. Received type object</code></p>
  <p>It works fine when trying with <code>ngrok</code> in local server configuration. The only issue when setting up the webhook in live server configuration. Please check the code below</p>
  <pre><code>        const path = require(&quot;path&quot;);
          const publicPath = path.join(__dirname, &quot;../public&quot;);
          const express = require(&quot;express&quot;);
          const http = require(&quot;http&quot;);
          const env = require(&quot;dotenv&quot;);
          const bodyParser = require(&quot;body-parser&quot;);
          env.config({
              path: path.resolve(__dirname + &quot;/.env&quot;)
          });
          const app = express();
          const server = http.createServer(app);
          
          const adminActionRoute = require('./routes/admin');
  
          app.use(express.static(publicPath));
          app.use(bodyParser.json({ verify: verifyRequestSignature }));
          app.use(bodyParser.urlencoded({ limit: '200mb', extended: true                         }));
          app.use('/api/admin', adminActionRoute);
          
          const viberBot = require('../viber_chat/utils/bot')
          app.use('/viber/webhook', viberBot.middleware())
          
          server.listen(5000, () =&gt; {
              viberBot.setWebhook(process.env.VB_WEBHOOK_URL);
              console.log(&quot;server starts at port 5000&quot;);
          });
  
  
          module.exports = server; //for testing 
  </code></pre>
  <p>'/viber_chat/utils/bot' file</p>
  <pre><code>        require('dotenv').config();
          const ViberBot = require('viber-bot').Bot;
          const BotEvents = require('viber-bot').Events;
          const logger = require('../utils/logger');
  
          const bot = new ViberBot(logger, {
              authToken: process.env.VB_API_KEY, 
              name: &quot;Bot Name&quot;,
              avatar: &quot;&quot; 
          });
  
          bot.onSubscribe(response =&gt; {
             
          });
  
          bot.on(BotEvents.CONVERSATION_STARTED, (response) =&gt; {
          
          })
  
  
          module.exports = bot;
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>TypeError [ERR_INVALID_ARG_TYPE]: The &quot;data&quot; argument must be one of type string, TypedArray, or DataView. Received type object
      at Hmac.update (internal/crypto/hash.js:58:11)
      at MessageValidator._calculateHmacFromMessage (/home/thettun/project_folder/funfun_viber/node_modules/viber-bot/lib/message/message-validator.js:19:54)
      at MessageValidator.validateMessage (/home/thettun/project_folder/funfun_viber/node_modules/viber-bot/lib/message/message-validator.js:11:30)
      at _app.use (/home/thettun/project_folder/funfun_viber/node_modules/viber-bot/lib/middleware.js:61:32)
      at Layer.handle [as handle_request] (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/layer.js:95:5)
      at trim_prefix (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:317:13)
      at /home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:284:7
      at Function.process_params (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:335:12)
      at next (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:275:10)
      at textParser (/home/thettun/project_folder/funfun_viber/node_modules/body-parser/lib/types/text.js:60:7)
      at Layer.handle [as handle_request] (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/layer.js:95:5)
      at trim_prefix (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:317:13)
      at /home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:284:7
      at Function.process_params (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:335:12)
      at next (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/router/index.js:275:10)
      at expressInit (/home/thettun/project_folder/funfun_viber/node_modules/express/lib/middleware/init.js:40:5)
  </code></pre>