Our Viber Messaging API designed to fullfill most of your use cases and can be easily integrate to any of the system. We can implement single Viber message, Personlized batch Viber Message using this API.
POST
/viber/v1/send
Authentication
AUTHORIZATION: Bearer Token
Request parameters
Parameter
Value / Pattern
*originator
The Sender/Header of a viber message. We can use your brand name. If you would like to register a new Sender ID, you can submit your details in Register originator Section in Viber Getting Started Page
*label
Enum: "PROMOTION" "TRANSACTION". Describes the nature of message being sent to end user. Default value is "promotion".
*recipients
Mobile Numbers to send viber messages separated by comma in an array. The recipient's phone number should have a country code prefix. You can also set the Default Countryhere, and all your messages will be prefixed with the selected country code.
*content
The message content is being sent. Limited to 1000 UTF-8 characters. Also, billing will be based on the number of message parts sent
image
The URL address of image to be sent to end user. Image can be sent only by itself or combined with text and button. Image can be sent only if label is set to "promotion". If label is set to "transaction" this parameter must be empty.
file_name (url)
The name of the file shared by the business with the user.
video
The data of the video shared by the business with the user.
*duration: The duration of the video in seconds.
*fileSize: The size of the video file in MB.
*thumbnail: A static image url that acts as the preview image for the video.
*url: Public video URL.
button_action
The link of button action. Button can be sent only if label is set to "promotion". If label is set to "transaction" this parameter must be empty.
button_caption
Text found on the button. Button can be sent only if message contains text and only if label is set to "promotion". If label is set to "transaction" this parameter must be empty. Maximum length is 30 characters.
*channel
To select the messaging channel that you want to use. (e.g., SMS, WhatsApp, Viber, Telegram, etc.)
call_back_url
To receive delivery status (DLR) for your viber message, specify the callback server URL where you want to receive the message status updates using the call_back_url parameter. When the delivery status changes, the status updates will be sent to the specified URL. For information on the format of the DLR message, please refer to the "Receiving DLR" section.
Response
When the request is validated, request_id, status and created time will be returned. Users can use this request_id to query status using the Get status endpoint.
{"detail":{"code":"ACCESS_TOKEN_SIGNATURE_VERIFICATION_FAILED","message":"It looks like your requests were failed due to a missing or invalid 'Access Token'. Sign up at https://app.d7networks.com and create an authentication token in the developer section."}}
constClient=require('direct7')constclient=newClient(apiToken="Your API token")constresponse=awaitclient.viber.sendViberMessage({recipients:["+97150900XXXX","+97845900XXX"],content:'Hello, this is a test message!',label:'PROMOTION',originator:'SignOTP',call_back_url:'https://the_url_to_recieve_delivery_report.com'});console.log(response);
fromdirect7importClientclient=Client(api_token="Your API token")client.viber.send_viber_message(recipients=["+97150900XXXX","+97845900XXX"],content="Greetings from D7 API",label="PROMOTION",originator="INFO2WAY",call_back_url="https://the_url_to_recieve_delivery_report.com")
require_once__DIR__.'/vendor/autoload.php';usedirect7\Direct7\Client;$client=newClient(api_token="Your API token")$response=$direct7->viber->sendViberMessage(recipients:["+97150900XXXX","+97845900XXX"],content:'Hello, World!',label:'PROMOTION',originator:'SignOTP',call_back_url:'https://example.com/callback');var_dump($response);
import("github.com/d7networks/direct7-go-sdk/direct7")apiToken:="Your Api Token"client:=direct7.NewClient(apiToken)viber:=direct7.NewViber(client)recipients:=[]string{"{{recipient}}"}content:="Greetings from D7 API"label:="PROMOTION"originator:="INFO2WAY"callBackURL:="https://the_url_to_recieve_delivery_report.com"response,err:=viber.SendViberMessage(recipients,content,label,originator,callBackURL)
varheaders={'Content-Type':'application/json','Accept':'application/json','Authorization':'Bearer {{api_access_token}}'};varrequest=http.Request('POST',Uri.parse('https://api.d7networks.com/viber/v1/send'));request.body=json.encode({"messages":[{"channel":"viber","recipients":["{{recipient1}}","{{recipient2}}"],"content":"Greetings from D7 API","label":"PROMOTION"}],"message_globals":{"originator":"SignOTP","call_back_url":"https://the_url_to_recieve_delivery_report.com"}});request.headers.addAll(headers);http.StreamedResponseresponse=awaitrequest.send();if(response.statusCode==200){print(awaitresponse.stream.bytesToString());}else{print(response.reasonPhrase);}
require'direct7'client=Direct7::Client.new('Your API token')client.viber.send_viber_message(recipients=["+97150900XXXX","+97845900XXX"],content="Greetings from D7 API",label="PROMOTION",originator="INFO2WAY",call_back_url="https://the_url_to_recieve_delivery_report.com")
varaxios=require('axios');vardata=JSON.stringify({"messages":[{"recipients":["{{recipient1}}","{{recipient2}}"],"content":"Greetings from D7 API - First message","label":"PROMOTION"},{"recipients":["{{recipient3}}","{{recipient4}}"],"content":"Greetings from D7 API - Second Message","label":"PROMOTION"}],"message_globals":{"channel":"viber","originator":"SignOTP","call_back_url":"https://the_url_to_recieve_delivery_report.com"}});varconfig={method:'post',url:'https://api.d7networks.com/viber/v1/send',headers:{'Content-Type':'application/json','Accept':'application/json','Authorization':'Bearer {{api_access_token}}'},data:data};axios(config).then(function(response){console.log(JSON.stringify(response.data));}).catch(function(error){console.log(error);});
importrequestsimportjsonurl="https://api.d7networks.com/viber/v1/send"payload=json.dumps({"messages":[{"recipients":["{{recipient1}}","{{recipient2}}"],"content":"Greetings from D7 API - First message",},{"recipients":["{{recipient3}}","{{recipient4}}"],"content":"Greetings from D7 API - Second Message",}],"message_globals":{"channel":"viber","originator":"SignOTP","label":"PROMOTION","call_back_url":"https://the_url_to_recieve_delivery_report.com"}})headers={'Content-Type':'application/json','Accept':'application/json','Authorization':'Bearer {{api_access_token}}'}response=requests.request("POST",url,headers=headers,data=payload)print(response.text)
varheaders={'Content-Type':'application/json','Accept':'application/json','Authorization':'Bearer {{api_access_token}}'};varrequest=http.Request('POST',Uri.parse('https://api.d7networks.com/viber/v1/send'));request.body=json.encode({"messages":[{"recipients":["{{recipient1}}","{{recipient2}}"],"content":"Greetings from D7 API - First message","label":"PROMOTION"},{"recipients":["{{recipient3}}","{{recipient4}}"],"content":"Greetings from D7 API - Second Message","label":"PROMOTION"}],"message_globals":{"channel":"viber","originator":"SignOTP","call_back_url":"https://the_url_to_recieve_delivery_report.com"}});request.headers.addAll(headers);http.StreamedResponseresponse=awaitrequest.send();if(response.statusCode==200){print(awaitresponse.stream.bytesToString());}else{print(response.reasonPhrase);}
require"uri"require"json"require"net/http"url=URI("https://api.d7networks.com/viber/v1/send")https=Net::HTTP.new(url.host,url.port)https.use_ssl=truerequest=Net::HTTP::Post.new(url)request["Content-Type"]="application/json"request["Accept"]="application/json"request["Authorization"]="Bearer {{api_access_token}}"request.body=JSON.dump({"messages":[{"recipients":["{{recipient1}}","{{recipient2}}"],"content":"Greetings from D7 API - First message","label":"PROMOTION"},{"recipients":["{{recipient3}}","{{recipient4}}"],"content":"Greetings from D7 API - Second Message","label":"PROMOTION"}],"message_globals":{"channel":"viber","originator":"SignOTP","call_back_url":"https://the_url_to_recieve_delivery_report.com"}})response=https.request(request)putsresponse.read_body