Skip to main content
All CollectionsWebhook Integration
Custom Webhook integration guide
Custom Webhook integration guide
Gin Lin avatar
Written by Gin Lin
Updated over 4 months ago

Only Custom plan users can integrate with Webhook. If you are interested in Webhook Integration, please contact the Cooby Sales Team.

In this guide, you'll connect WhatsApp to your destination using Cooby custom Webhooks.

You can use the same Webhook for the 2 different event triggers, or set up separate Webhooks for each event trigger.


Set up guide

This guide uses webhook.site as an example

  1. Go to your workspace integration center

  2. Find Custom Webhook and click on Integration Guide.

  3. Create a Webhook endpoint in your desired destination.

    1. Remember to mark CORS Headers as checked

  4. Paste the Webhook URL into the Trigger actions when receiving WhatsApp messages field in the Cooby integration guide, then click Save.

    1. If you would like to trigger an action when sending a WhatsApp message, paste your Webhook URL in Trigger actions when send WhatsApp messages.

  5. Ensure that you see the Webhook URL saved, indicating a successful save.

  6. Go back to the previous page and click on Manage Permissions for the Custom Webhook field.

  7. Turn ON the Custom Webhook permission for those who will trigger Webhook events when they receive WhatsApp messages.

  8. To ensure that the Webhook integration is set up properly, remember to refresh both your WhatsApp Web and the WhatsApp Web of your team members after making any changes to the settings.

    1. All users in the team who have integration permission will see the Grant Access to Cooby popup the next time they open or refresh WAW.

  9. Once you have received the payload, you can use it to set up various actions.


Payload Format

{
chat_id: string;
chat_type: "group" | "individual";
chat_title: string;
user_phone: string;
user_email: string;
direction: "sent" | "received";
message: {
id: string;
type: "call_log" | "chat" | "location" | "payment" | "vcard" | "ciphertext" | "multi_vcard" | "revoked" | "oversized" | "groups_v4_invite" | "template_button_reply" | "debug" | "image" | "video" | "audio" | "sticker" | "status_v3" | "document" | "product" | "order" | "list" | "interactive" | "interactive_response" | "list_response" | "buttons_response" | "reaction" | "reaction_enc" | "poll_creation" | "request_phone_number" | "poll_update" | "native_flow" | "biz-cover-photo" | "keep_in_chat" | "pin_message" | "unknown";
text: string;
file_name: string | null;
file_url: string| null;
caption: string | null;
is_error: boolean;
error_code: string | null;
error_message: string | null;
};
timestamp: string;
participants: {
phone: string;
wa_name: string;
}[];
sender: {
phone: string;
wa_name: string;
};
}


Example payload

{
chat_id: "[email protected]";
chat_type: "individual";
chat_title: "Sarah Brown";
user_phone: "447441368384";
user_email: "[email protected]";
direction: "sent";
message: {
id: "3EB093D273669B3BE3D2";
type: "chat";
text: "Hi, welcome to Cooby!";
file_name: "Cooby Image 2023-07-12 at 11.13.32 AM";
file_url: "https://api.cooby.co/v2/files/xxxxx";
caption: "Hi, welcome to Cooby!";
is_error: false;
error_code: null;
error_message: null;
};
timestamp: "1628843453";
participants: [
{
phone: "447441369136";
wa_name: "Sarah Brown";
},
{
phone: "447441368384",
wa_name: "Cooby"
}
],
sender: {
phone: "447441368384";
wa_name: "Cooby";
};
}



We hope this document helps you better understand how Cooby works. For any concerns or questions regarding your Custom Webhook integration, kindly email us at [email protected] 💜

Did this answer your question?