{"id":15474869,"url":"https://github.com/danitechid/wa-web-api","last_synced_at":"2025-06-12T18:32:34.088Z","repository":{"id":204841397,"uuid":"712440220","full_name":"danitechid/wa-web-api","owner":"danitechid","description":"WhatsApp Web API - TypeScript/JavaScript. ditenagai oleh library: Baileys.","archived":false,"fork":false,"pushed_at":"2023-11-09T11:59:48.000Z","size":52,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T14:09:26.348Z","etag":null,"topics":["api","baileys","baileys-bot","nodejs","wa-bot","wabot","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-web","whatsapp-web-api"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@danitech/wa-web-api","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danitechid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-31T13:30:04.000Z","updated_at":"2025-04-05T23:22:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"cf1c98e5-c947-4cda-b96c-41eb8297a920","html_url":"https://github.com/danitechid/wa-web-api","commit_stats":null,"previous_names":["danitechid/wa-web-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/danitechid/wa-web-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danitechid%2Fwa-web-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danitechid%2Fwa-web-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danitechid%2Fwa-web-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danitechid%2Fwa-web-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danitechid","download_url":"https://codeload.github.com/danitechid/wa-web-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danitechid%2Fwa-web-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259519178,"owners_count":22870324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","baileys","baileys-bot","nodejs","wa-bot","wabot","whatsapp","whatsapp-api","whatsapp-bot","whatsapp-web","whatsapp-web-api"],"created_at":"2024-10-02T03:05:32.207Z","updated_at":"2025-06-12T18:32:34.016Z","avatar_url":"https://github.com/danitechid.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WhatsApp Web API - TypeScript/JavaScript\r\nWhatsApp Web API ini ditenagai oleh library: Baileys\r\n\r\n## Instalasi\r\n### Menggunakan Npm\r\n```bash\r\nnpm i @danitech/wa-web-api\r\n```\r\n\r\n### Atau Menggunakan Yarn\r\n```bash\r\nyarn add @danitech/wa-web-api\r\n```\r\n\r\n## Contoh Kode\r\n### ./package.json\r\n```json\r\n{\r\n  \"name\": \"whatsapp-bot\",\r\n  \"version\": \"0.0.0\",\r\n  \"private\": true,\r\n  \"main\": \"index.js\",\r\n  \"scripts\": {\r\n    \"start\": \"node index.js\",\r\n    \"dev\": \"nodemon index.js\"\r\n  },\r\n  \"dependencies\": {\r\n    \"@danitech/wa-web-api\": \"latest\"\r\n  },\r\n  \"devDependencies\": {\r\n    \"nodemon\": \"~3.0.1\"\r\n  }\r\n}\r\n```\r\n\r\n### ./nodemon.json\r\n```json\r\n{\r\n  \"ignore\": [\"index.js\"],\r\n  \"ext\": \"js\"\r\n}\r\n```\r\n\r\n### ./index.js\r\n```javascript\r\nconst wwa = require('@danitech/wa-web-api');\r\nconst fs = require('fs');\r\nconst chalk = require('chalk');\r\nconst config = require('./config/settings.js');\r\nconst client = require('./includes/client.js');\r\n\r\nconst {\r\n  makeWASocket\r\n} = wwa;\r\n\r\nconst startServer = (config, client) =\u003e {\r\n  return makeWASocket(config, client);\r\n};\r\n\r\nstartServer(config, client);\r\n```\r\n\r\n### ./config/settings.js\r\n```javascript\r\nmodule.exports = {\r\n  pairing_mode: true,\r\n  session_folder_name: 'session',\r\n  browser: [\"Chrome (Linux)\"],\r\n  public_mode: true,\r\n  prefix: '.',\r\n  bot: {\r\n    name: 'Bot Name'\r\n  },\r\n  owner: {\r\n    name: 'Owner Name',\r\n    number: '628xxx'\r\n  }\r\n};\r\n```\r\n\r\n### ./includes/client.js\r\n```javascript\r\nconst chalk = require('chalk');\r\nconst config = require('../config/settings.js');\r\n\r\nmodule.exports = async ({\r\n  client,\r\n  messages\r\n}) =\u003e {\r\n  try {\r\n    const body = messages.mtype === 'conversation' ? messages.message.conversation : messages.mtype === 'extendedTextMessage' ? messages.message.extendedTextMessage.text : '';\r\n    const budy = typeof messages.text === 'string' ? messages.text : '';\r\n    const command = body.startsWith(config.prefix) ? body.replace(config.prefix, '').trim().split(/ +/).shift().toLowerCase() : '';\r\n    const cleanCommand = command.replace(config.prefix, '');\r\n    const args = body.trim().split(/ +/).slice(1);\r\n    const query = q = args.join(' ');\r\n    const query1 = q1 = query.split('|')[0]\r\n    const query2 = q2 = query.split('|')[1]\r\n\r\n    const ownerNumbers = config.owner.number;\r\n    const senderNumber = messages.sender.replace(/\\D/g, '');\r\n    const senderName = messages.pushName || 'Undefined';\r\n    const isOwner = ownerNumbers.includes(messages.sender);\r\n\r\n    if (!config.public_mode) {\r\n      if (!messages.key.fromMe) {\r\n        return;\r\n      };\r\n    };\r\n\r\n    if (messages.message) {\r\n      client.readMessages([messages.key]);\r\n\r\n      console.log(\r\n        chalk.bgMagenta(' [New Message] '),\r\n        chalk.cyanBright('Time: ') + chalk.greenBright(new Date()) + '\\n',\r\n        chalk.cyanBright('Message: ') + chalk.greenBright(budy || messages.mtype) + '\\n' +\r\n        chalk.cyanBright('From:'), chalk.greenBright(senderName), chalk.yellow('- ' + senderNumber) + '\\n' +\r\n        chalk.cyanBright('Chat Type:'), chalk.greenBright(!messages.isGroup ? 'Private Chat' : 'Group Chat - ' + chalk.yellow(messages.chat))\r\n      );\r\n    };\r\n\r\n    if (!body.startsWith(config.prefix) || body === config.prefix) {\r\n      return;\r\n    };\r\n\r\n    switch (cleanCommand) {\r\n      case 'test': {\r\n        messages.reply('Ok, Success!');\r\n        break;\r\n      };\r\n      \r\n      default: {\r\n        messages.reply(`Command: ${config.prefix}${cleanCommand}, tidak tersedia!`);\r\n      };\r\n    };\r\n  } catch (error) {\r\n    messages.reply('Terjadi kesalahan pada server.');\r\n    console.error(error);\r\n  };\r\n};\r\n```\r\n\r\n### Contoh kode/skrip bot WhatsApp lengkap\r\n\u003ca href=\"https://github.com/danitechid/example-wa-bot-script\"\u003eKlik disini\u003c/a\u003e untuk mengunduh proyek.\r\n\r\n## Informasi\r\n* Pembuat / Pengembang: Dani Ramdani (Dani Techno.) - FullStack Engineer\r\n* Kontak Pembuat / Pengembang: 0895 1254 5999 (WhatsApp), contact@danitechno.com (Email)\r\n\r\n## Terimakasih Kepada\r\n* Dani Techno. - FullStack Engineer (Pembuat / Pengembang)\r\n* @whiskeysockets/baileys (Penyedia Library \"Baileys\")","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanitechid%2Fwa-web-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanitechid%2Fwa-web-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanitechid%2Fwa-web-api/lists"}