Create a Group
Creates a WhatsApp group. This call is asynchronous. This means that the group will not be ready until your client receives a ‘GroupCreated’ notification from the API.
Url
https://ongair.im/api/v1/base/create_group
Method:
POST
Params:
Field | Type | Mandatory | Format | Meaning |
---|---|---|---|---|
name | String | Yes | Utf8 only encoded strings | The group subject name |
Members | Array | Yes | Utf8 only encoded strings | The phone number of the members to be added to the group |
Example:
curl –d “name=GroupName&members[]=254722200200&members[]=254722201201&token=YOUR_API_TOKEN” https://app.ongair.im/api/v1/base/create_group
Response:
The server responds with a JSON message:
{"created":true,"id":2067}
Error:
If there is an error or the group name already exists, the server returns an error message and response code of 422.
{"error":"Group with the name ‘test’ already exists"}
Callback:
This is a web hook posted to the client when the WhatsApp group is ready. This callback is usually a second or two after the original call.This is a web hook posted to the client when the WhatsApp group is ready. This callback is usually a second or two after the original call.
Field | Type | Value | Meaning |
---|---|---|---|
notification_type | String | GroupCreated | The type of the notification |
name | String | Cooking Class | The name of the group |
id | Integer | 2067 | The identifier of the group. This is the same id returned when the create group was sent. |