add-campaign (send now)
curl --request POST \
--url 'http://{{base_url}}/api/v1/venom/add-campaign' \
--header 'Content-Type: application/json' \
--data '
{
"name": "send-now-4",
"desc": "1",
"html": "<p>send-now-4</p>",
"image": null,
"group_metadata_ids": [
8
],
"is_channel_campaign": true,
"is_schedule": false,
"schedule_time": "2023-12-22 12:18:00"
}
'import requests
url = "http://{{base_url}}/api/v1/venom/add-campaign"
payload = {
"name": "send-now-4",
"desc": "1",
"html": "<p>send-now-4</p>",
"image": None,
"group_metadata_ids": [8],
"is_channel_campaign": True,
"is_schedule": False,
"schedule_time": "2023-12-22 12:18:00"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'send-now-4',
desc: '1',
html: '<p>send-now-4</p>',
image: null,
group_metadata_ids: [8],
is_channel_campaign: true,
is_schedule: false,
schedule_time: '2023-12-22 12:18:00'
})
};
fetch('http://{{base_url}}/api/v1/venom/add-campaign', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://{{base_url}}/api/v1/venom/add-campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'send-now-4',
'desc' => '1',
'html' => '<p>send-now-4</p>',
'image' => null,
'group_metadata_ids' => [
8
],
'is_channel_campaign' => true,
'is_schedule' => false,
'schedule_time' => '2023-12-22 12:18:00'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://{{base_url}}/api/v1/venom/add-campaign"
payload := strings.NewReader("{\n \"name\": \"send-now-4\",\n \"desc\": \"1\",\n \"html\": \"<p>send-now-4</p>\",\n \"image\": null,\n \"group_metadata_ids\": [\n 8\n ],\n \"is_channel_campaign\": true,\n \"is_schedule\": false,\n \"schedule_time\": \"2023-12-22 12:18:00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://{{base_url}}/api/v1/venom/add-campaign")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"send-now-4\",\n \"desc\": \"1\",\n \"html\": \"<p>send-now-4</p>\",\n \"image\": null,\n \"group_metadata_ids\": [\n 8\n ],\n \"is_channel_campaign\": true,\n \"is_schedule\": false,\n \"schedule_time\": \"2023-12-22 12:18:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{{base_url}}/api/v1/venom/add-campaign")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"send-now-4\",\n \"desc\": \"1\",\n \"html\": \"<p>send-now-4</p>\",\n \"image\": null,\n \"group_metadata_ids\": [\n 8\n ],\n \"is_channel_campaign\": true,\n \"is_schedule\": false,\n \"schedule_time\": \"2023-12-22 12:18:00\"\n}"
response = http.request(request)
puts response.read_bodyCampaigns
Add Campaign
This api is to send campaigns instantly.
| field_names | description | comment |
|---|---|---|
| name | string | |
| desc | string | |
| html | string | |
| image | string | base64 string of media file |
| group_metadata_ids | number[] | |
| is_channel_campaign | boolean | |
| is_schedule | boolean | |
| schedule_time | Datetime |
-
Headings (
h1,h2****,h3****,h4****,h5****,h6****) for formatting text as bold in WhatsApp. -
Emphasis tags (
i,em__) for italicizing text. -
Strong emphasis tags (
b,strong****) for bold text. -
Paragraphs (
p) and line breaks (br) for managing text flow and spacing. -
Hyperlinks (
a) for including clickable links. -
Lists (
ulfor unordered lists andolfor ordered lists) and list items (li) for formatting lists. -
Span(span) for inline text formatting without additional styling.Please note that the html will be mapped to whatsapp format, this might create some discrepancy in formatting.
POST
/
api
/
v1
/
venom
/
add-campaign
add-campaign (send now)
curl --request POST \
--url 'http://{{base_url}}/api/v1/venom/add-campaign' \
--header 'Content-Type: application/json' \
--data '
{
"name": "send-now-4",
"desc": "1",
"html": "<p>send-now-4</p>",
"image": null,
"group_metadata_ids": [
8
],
"is_channel_campaign": true,
"is_schedule": false,
"schedule_time": "2023-12-22 12:18:00"
}
'import requests
url = "http://{{base_url}}/api/v1/venom/add-campaign"
payload = {
"name": "send-now-4",
"desc": "1",
"html": "<p>send-now-4</p>",
"image": None,
"group_metadata_ids": [8],
"is_channel_campaign": True,
"is_schedule": False,
"schedule_time": "2023-12-22 12:18:00"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'send-now-4',
desc: '1',
html: '<p>send-now-4</p>',
image: null,
group_metadata_ids: [8],
is_channel_campaign: true,
is_schedule: false,
schedule_time: '2023-12-22 12:18:00'
})
};
fetch('http://{{base_url}}/api/v1/venom/add-campaign', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://{{base_url}}/api/v1/venom/add-campaign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'send-now-4',
'desc' => '1',
'html' => '<p>send-now-4</p>',
'image' => null,
'group_metadata_ids' => [
8
],
'is_channel_campaign' => true,
'is_schedule' => false,
'schedule_time' => '2023-12-22 12:18:00'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://{{base_url}}/api/v1/venom/add-campaign"
payload := strings.NewReader("{\n \"name\": \"send-now-4\",\n \"desc\": \"1\",\n \"html\": \"<p>send-now-4</p>\",\n \"image\": null,\n \"group_metadata_ids\": [\n 8\n ],\n \"is_channel_campaign\": true,\n \"is_schedule\": false,\n \"schedule_time\": \"2023-12-22 12:18:00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://{{base_url}}/api/v1/venom/add-campaign")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"send-now-4\",\n \"desc\": \"1\",\n \"html\": \"<p>send-now-4</p>\",\n \"image\": null,\n \"group_metadata_ids\": [\n 8\n ],\n \"is_channel_campaign\": true,\n \"is_schedule\": false,\n \"schedule_time\": \"2023-12-22 12:18:00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://{{base_url}}/api/v1/venom/add-campaign")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"send-now-4\",\n \"desc\": \"1\",\n \"html\": \"<p>send-now-4</p>\",\n \"image\": null,\n \"group_metadata_ids\": [\n 8\n ],\n \"is_channel_campaign\": true,\n \"is_schedule\": false,\n \"schedule_time\": \"2023-12-22 12:18:00\"\n}"
response = http.request(request)
puts response.read_bodyHeaders
Body
application/json
The body is of type object.
Response
200 - application/json
Successful response