In this tutorial, you can learn how to get a WhatsApp Group invitation link and send it to users allowing them to join your Group using the Wassenger API and Python
Expanding your audience by sending WhatsApp group invite links is highly effective, thanks to WhatsApp’s impressive 98% open rates. Imagine being able to send personalized recommendations, answer common questions, and analyze market trends automatically and instantly.
However, enhanced WhatsApp privacy features now make it difficult to automatically add users to groups if they haven’t saved your number, as their privacy settings may prevent it.
The good news is there’s a solution covered in this tutorial: you can send a private message to specific users with the group invite link, enabling them to join the group.
To achieve this, you’ll perform two tasks using the API:
1. Obtain the WhatsApp group invitation link: You must be a participant with invite permissions in the target group. 2. Send the group invite link via private WhatsApp message to the user.
Find more information and code examples below!
🤩 🤖 Wassenger is a complete communication platform and API solution for WhatsApp. Explore more than 100+ API use cases and automate anything on WhatsApp by signing up for a free trial and get started in minutes!
Requirements
- Have a WhatsApp number already linked to the platform and online.
- Get your Wassenger API key here
- Group WhatsApp ID (WID) that you can find in two ways:
How to obtain the Group WhatsApp ID
You can obtain the Group WhatsApp ID by using one of these methods:
- Web: go to number’s settings > Groups > Copy the Group WID.
- API: query the available groups in your number using this endpoint.
API endpoint
We will use the following API endpoints to send messages to a group:
🖥️ Looking for a code example? Go to the API live tester and get ready-to-use code examples in 15+ programming languages, including Python, JavaScript, PHP, C#, Java, Ruby, Go, Powershell, cURL and more.
Get the invitation link using Python
# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
import requests
url = "https://api.wassenger.com/v1/devices/$DEVICE_ID/groups/$GROUP_ID@g.us/invite"
headers = {"Token": "ENTER API KEY HERE"}
response = requests.get(url, headers=headers)
print(response.json())
You will get something like:
{
"code": "CPBgYNktDdV0nkjzz9",
"url": "https://chat.whatsapp.com/CPBgYNktDdV0nkjzz9"
}
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Now, you can share the link with the contacts you want to invite to your group.
Send a message with the given link using Python
# Examples requires to have installed requests Python package.
# Install it by running: pip install requests
import requests
url = "https://api.wassenger.com/v1/messages"
payload = {
"phone": "+1234567890",
"message": "Join our Newsleter group!: https://chat.whatsapp.com/CPBgYNktDdV0nkjzz9"
}
headers = {
"Content-Type": "application/json",
"Token": "ENTER API KEY HERE"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!
Live API testing
You can live-test and play with the API directly from your browser.
Once you are done testing, get the auto-generated code example in your preferred programming language and you will be ready to go.
🤩 🤖 Wassenger is a complete API solution for WhatsApp. Sign up for a 7-day free trial and get started in minutes!







