rumahweb/whatsapp-sdk
Composer 安装命令:
composer require rumahweb/whatsapp-sdk
包简介
README 文档
README
Whatsapp API SDK hanya untuk penggunaan keperluan perusahaan
Core concept
Penting untuk diketahui penggunaan sdk ini dipakai di end aplikasi, tidak menghandle langsung hook pada whatsapp.
1. Facebook akan mengirim WebHook ke gateway contoh gateway.domain.id 2. Gateway melakukan handshake dengan facebook terkait webhook apakah sesuai key atau tidak 3. Gateway meneruskan hook facebook ke end aplikasi contoh end.domain.id 4. end aplikasi inilah yang akan menggunakan sdk ini
Information
Ada beberapa type webhook yang dikirim oleh facebook
-
Message
- text
- image
- sticker
- documents
- unknown (ex pesan tidak support)
- button
-
Status
- sent
- delivered
- read
- failed
Features
- Send text message
- Generate webhook message (bukan memvalidasi webhook facebook secara langsung)
- Send image message
- Send document message
Usage
$token: Token facebook$wabaId: WhatsApp business account id
use Rumahweb\WhatsApp; $whatsApp = WhatsApp::init($token);
Message
$message = $whatsApp->message($wabaId); # Text message $message->sendText("6285747277xxx", "Hello World");
Message Template
to: nomor penerimaheader: header template (optional)body: body template (optional)
$params["to"] = "xxxx"; $params["header"] = [ [ "type" => "text", "text" => "pesan nya apa" ] ] $params["body"] = [ [ "type" => "text", "text" => "pesan nya apa" ] ] $template = $whatsApp->template($wabaId); $template->send("nama_template", $params);
Pastikan index array di header dan body sama dengan template yang telah dibuat di facebook sesuai urutan variabel nya.
Ref: disini
Contoh Response Success
Array ( [messaging_product] => whatsapp [contacts] => Array ( [0] => Array ( [input] => +6285747277xxx [wa_id] => 6285747277xxx ) ) [messages] => Array ( [0] => Array ( [id] => wamid.HBgNNjI4NTc0NzI3NzQ2NhU [message_status] => accepted ) ) )
Hook
hook contoh dibawah merupakah return dari method berikut:
$hook = ['array', 'data', 'from', 'facebook']; $webhook = new Rumahweb\Webhook($hook); print_r($hook);
Keterangan :
phone_display: Nomor hp whatsappphone_id: Phone number id device whatsapphook_type: saat ini hanya ada 2 (message&status)wamid: WhatsApp message ID
Message type
Text message
{
"phone_display": "1234567890",
"phone_id": "987654321",
"hook_type": "message",
"from_name": "addin",
"from_phone": "6285747277xxx",
"wamid": "wamid.HBgNNjI4NTxxxxxx",
"timestamp": "1746604743",
"type": "text",
"text": "Halo ini pesan dari addin"
}
Status Type
recipient_phone: penerima message
Status Delivered
{
"phone_display": "1234567890",
"phone_id": "987654321",
"hook_type": "status",
"wamid": "wamid.HBgNNxxxx",
"status": "delivered",
"timestamp": "1746595471",
"recipient_phone": "6285747277xxx"
}
Status sent
{
"phone_display": "1234567890",
"phone_id": "987654321",
"hook_type": "status",
"wamid": "wamid.HBgNNjIxx",
"status": "sent",
"timestamp": "1752630521",
"recipient_phone": "6285747277xxx"
}
Status Failed
{
"phone_display": "1234567890",
"phone_id": "987654321",
"hook_type": "status",
"wamid": "wamid.HBgNxx",
"status": "failed",
"timestamp": "1752629020",
"recipient_phone": "6285747277xxx"
}
Status Read
{
"phone_display": "1234567890",
"phone_id": "987654321",
"hook_type": "status",
"wamid": "wamid.HBgNNjxx",
"status": "read",
"timestamp": "1752630698",
"recipient_phone": "6285747277xxx"
}
Example error
Array ( [error] => Array ( [message] => Invalid OAuth access token - Cannot parse access token [type] => OAuthException [code] => 190 [fbtrace_id] => AtYQl3mJPwLPhH-m_buoHAI ) )
Array
(
[error] => Array
(
[message] => (#132001) Template name does not exist in the translation
[type] => OAuthException
[code] => 132001
[error_data] => Array
(
[messaging_product] => whatsapp
[details] => template name (event_reminder3) does not exist in id_ID
)
[fbtrace_id] => AGSJexhOhNweWMeFsVy4y05
)
)
rumahweb/whatsapp-sdk 适用场景与选型建议
rumahweb/whatsapp-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rumahweb/whatsapp-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rumahweb/whatsapp-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-16