Wooxy API v.3.0

Send Web Push

The Send Web Push method allows you to send Web push notifications to any contact in your list. You can manually select the domain from which to send them and the content to send.

Important: Using a button without text block is not possible.

Important: Up to 2 buttons can be added to the Template.

Request

POST
https://api.wooxy.com/v3/web-push/send

IMPORTANT: Do not send more than 10 concurrent API requests.

Body Example

                                        {
   "contactListId": "YOUR_CONTACT_LIST_ID",
   "domain":        "senderDomain.com",
   "contact":       "user@example.com",
   "title":         "PUSH_TITLE",
   "text":          "PUSH_CONTENT_TEXT",
   "link":          "FINAL_DESTINATION_URL",
   "image":         "ICON_IMAGE_URL",
   "richImage": "BANNER_IMAGE_URL",
   "buttons": [ 
   { 
   "title": "Title of button", 
   "url":"FINAL_DESTINATION_URL" 
   } 
   ], 
   "tags": [
      "pushNotificationTag"
   ],
   "device":        "desktop",
   "ttl":           "3600"
}
                                    

Parameters

Title Type Default Description

contactListId

required
string

ID of the contact list which the contact belongs to.  
The list should be already created in your account on the Lists page:  
https://app.wooxy.com/email-list

domain

required
string

Verified domain name from your Wooxy account. This data is used to send you webhooks and generate reports.

contact

required
string

The 'email' address, 'userId' or 'phoneNumber' of the recipient stored in the corresponding contactList.

title

required
string

Text title to be sent via web push.

text

required
string

Web Push content text you want to send.

link

optional
string

Link to the page where subscribers will get when they click on the link.

image

optional
string

Shows subscribers who’ve sent the the web push notification.

NOTE: Argument image must be a non-empty string of valid image URL with aspect 1:1 and recommended size between 84×84 and 128×128

WARNING:if you don’t use an icon, the user will see a standard browser logo.

tags

optional
array null

An array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or changed frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.

device

optional
string both

Add kinds of browsers to the parameter. Available options.
Important:By default, we send to both browsers:

  • desktop: Notifications will only be shown on the desktop version of the browser;
  • mobile: Notifications will only be shown on the mobile version of the browser.

ttl

optional
string "3600"

Time to live must be specified in seconds. Between 30 minutes to  72 hour.

buttons

optional
array null

Object array is the parameter that allows you to add a button to your web push notifications.

buttons.title

optional
string

The title for button name.

buttons.url

optional
string

The link to the page where subscribers will get when they click on the link.

richImage

optional
string

Allows you to add a link to your banner for web push notifications.

Response

                                        {
   "result": true,
   "notifications_ids": "5d914c3dd132d5f45a4e3670"
}
                                    

Parameters

Title Type Description

notifications_ids

string

The notification unique identification number in the Wooxy system. With this ID number you can get all the statistics on each sent notification.

result

boolean

The sending status of the recipient:

  • true: The notification is accepted and queued;
  • false: The notification is rejected.

Method Errors

                                        {
   "result": false,
   "errors": [
      "Error description text"
   ]
}
                                    
Error

“Argument contactListId must be a non-empty string”

“Argument contact must be a non-empty string filled with valid email, phoneNumber or userId”

“Argument title must be a non-empty string”

“Argument text must be a non-empty string”

“Argument link must be a non-empty string of valid URL”

“Argument image must be a non-empty string of valid image URL with aspect 1:1 and recommended size between 84×84 and 128×128”

“Width of image must be between 84 and 128 pixels”

“Height of image must be between 84 and 128 pixels”

“Aspect ratio must be 1:1”

“Use https instead of http”

“Argument device must be a non-empty string”

“Argument device must be mobile or desktop”

“Argument tags must be an array”

“Tag name must be a non-empty string”

“Tags should be 50 characters or less”

“Any tags starting with an underscore are reserved for internal use and will cause errors”

“Argument ttl must be a numeric”

“Argument ttl must be between 30 minutes and 72 hours reproduced by seconds value”

“Argument device must be a non-empty string”

“Argument device must be mobile or desktop”

“Your notification data is to long. Maximum count of characters is 4078”

“Invalid authorization token!”

“Internal server error”

“Bad Request”

“no matches found for access token {accessToken}”

“user {id} not enabled”

“no data found for key {userId}”

“access token check failed for key\/secret $key\/$accessToken”

“Argument {argument} required”

“Argument buttons must be an array of arrays with \”title\” and \”url\” fields”

“You cannot add more 2 buttons”

“Argument button title must be present and not empty”

Code Examples

PHP
                $accessToken = "YOUR_API_KEY=";
$url = 'https://api.wooxy.com/v3/web-push/send';
$body = json_encode([
    'contactListId'=> 'YOUR_CONTACT_LIST_ID',
    'domain'=> 'senderDomain.com',
    'contact'=> 'user@example.com',
    'title'=> 'PUSH_TITLE',
    'text'=> 'PUSH_CONTENT_TEXT',
    'link'=> 'FINAL_DESTINATION_URL',
    'image'=> 'ICON_IMAGE_URL',
    'richImage' => "BANNER_IMAGE_URL",
    'buttons' => [
        [
            'title' => "Title of button",
            'url' => "FINAL_DESTINATION_URL"
        ]
    ],
    'tags'=> [
        'pushNotificationTag'
    ],
    'device'=> 'desktop',
    'ttl'=> '3600'
]);

/**
 * Request Example
 */
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_INFILESIZE, null);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Access-Token: $accessToken",
    'Content-Type: application/json',
    'Content-Length: ' . strlen($body),
]);

$result = curl_exec($ch);
if ($result === false) {
    echo 'cURL error:' . curl_error($ch) . PHP_EOL;
} else {
    echo strval($result) . PHP_EOL;
}
curl_close($ch);