Create a newsletter
curl --request POST \
--url https://api.wsapi.chat/newsletters \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Instance-Id: <x-instance-id>' \
--data '
{
"name": "My Newsletter",
"description": "Updates about cool stuff"
}
'import requests
url = "https://api.wsapi.chat/newsletters"
payload = {
"name": "My Newsletter",
"description": "Updates about cool stuff"
}
headers = {
"X-Instance-Id": "<x-instance-id>",
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Instance-Id': '<x-instance-id>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'My Newsletter', description: 'Updates about cool stuff'})
};
fetch('https://api.wsapi.chat/newsletters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));using RestSharp;
var options = new RestClientOptions("https://api.wsapi.chat/newsletters");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Instance-Id", "<x-instance-id>");
request.AddHeader("X-Api-Key", "<api-key>");
request.AddJsonBody("{\n \"name\": \"My Newsletter\",\n \"description\": \"Updates about cool stuff\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "01234567890123456"
}{
"status": 400,
"detail": "invalid request body"
}{
"status": 401,
"detail": "unauthorized"
}{
"status": 403,
"detail": "device not paired"
}{
"status": 503,
"detail": "instance not available"
}Newsletters
Create a newsletter
Create a new newsletter/channel with the specified name, description, and optional picture.
POST
/
newsletters
Create a newsletter
curl --request POST \
--url https://api.wsapi.chat/newsletters \
--header 'Content-Type: application/json' \
--header 'X-Api-Key: <api-key>' \
--header 'X-Instance-Id: <x-instance-id>' \
--data '
{
"name": "My Newsletter",
"description": "Updates about cool stuff"
}
'import requests
url = "https://api.wsapi.chat/newsletters"
payload = {
"name": "My Newsletter",
"description": "Updates about cool stuff"
}
headers = {
"X-Instance-Id": "<x-instance-id>",
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Instance-Id': '<x-instance-id>',
'X-Api-Key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: 'My Newsletter', description: 'Updates about cool stuff'})
};
fetch('https://api.wsapi.chat/newsletters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));using RestSharp;
var options = new RestClientOptions("https://api.wsapi.chat/newsletters");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("X-Instance-Id", "<x-instance-id>");
request.AddHeader("X-Api-Key", "<api-key>");
request.AddJsonBody("{\n \"name\": \"My Newsletter\",\n \"description\": \"Updates about cool stuff\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
{
"id": "01234567890123456"
}{
"status": 400,
"detail": "invalid request body"
}{
"status": 401,
"detail": "unauthorized"
}{
"status": 403,
"detail": "device not paired"
}{
"status": 503,
"detail": "instance not available"
}Authorizations
Instance or customer-level API key. Either the instance's own API key or the customer's API key is accepted. Must be paired with the X-Instance-Id header to identify the target instance.
Headers
The ID of the WhatsApp instance to use
Body
application/json
Response
Resource created
ID of the created resource
⌘I