Appearance
Linking a WhatsApp Device
Before you can send WhatsApp messages through our API, you need to link a WhatsApp device. This guide will walk you through the process.
Prerequisites
Before you can link a device, you need to:
- Have an active WhatsGate account
- Have a subscription with available device slots
- Have a smartphone with WhatsApp installed
Step 1: Create a Device
First, you need to create a device in your WhatsGate dashboard:
- Log in to your WhatsGate dashboard
- Navigate to the "Devices" section in the sidebar
- Click the "Create Device" button
- Enter a name for your device (e.g., "Marketing Phone", "Support", etc.)
- Enter the mobile number associated with the WhatsApp account (with country code, e.g., 971xxxxxxxxx)
- Click "Create" to create the device
INFO
If you don't have any available device slots, you may need to upgrade your subscription or purchase additional device slots.
Step 2: Verify the Device
After creating the device, you need to verify it:
- A verification code will be sent to the WhatsApp number you provided
- Enter this code in the verification field on the device edit page
- Click "Verify" to confirm the device
WARNING
If you don't receive the verification code, you can click "Regenerate Code" to send a new one.
Step 3: Connect the Device
Once the device is verified, you need to connect it to WhatsApp:
- On the device edit page, you'll see a QR code
- Open WhatsApp on your smartphone
- Go to Settings > Linked Devices
- Tap on "Link a Device"
- Scan the QR code displayed on your WhatsGate dashboard
After scanning the QR code, your device will be connected to WhatsGate, and you'll see a "Connected" status in your dashboard.
Using the Device in API Requests
When sending messages through the API, you need to specify which device to use by including the device's mobile number in the sender_device
parameter:
bash
curl -X POST \
https://{subdomain}.whatsgate.net/api/send/text \
-H 'Access-Token: your_api_token_here' \
-H 'Content-Type: application/json' \
-d '{
"sender_device": "971xxxxxxxxx",
"phone": "recipient_number",
"message": "Hello, this is a test message"
}'
Managing Devices
You can manage your devices from the "Devices" section in your dashboard:
- View devices: See a list of all your devices and their connection status
- Edit devices: Update device names or reconnect devices
- Disconnect devices: Disconnect a device from WhatsApp
- Delete devices: Remove devices you no longer need
Checking Device Status via API
You can check the connection status of a device using the API:
bash
curl -X GET \
https://{subdomain}.whatsgate.net/api/status/971xxxxxxxxx \
-H 'Access-Token: your_api_token_here'
The response will indicate whether the device is connected, disconnected, or not initialized.
Troubleshooting
Device Not Connecting
- Make sure your smartphone has an active internet connection
- Ensure WhatsApp is up to date on your smartphone
- Try refreshing the QR code and scanning again
- Restart WhatsApp on your smartphone
Device Disconnecting
- Ensure your smartphone has a stable internet connection
- Keep your smartphone powered on and connected to the internet
- Avoid logging out of WhatsApp on your smartphone
- If the device disconnects, you may need to reconnect it by scanning the QR code again
Next Steps
Now that you have linked a WhatsApp device, you can:
- Start sending messages using our API endpoints
- Explore the API Reference to learn about available endpoints