Skip to content

Commit a1234da

Browse files
authored
Add files via upload
1 parent cc93fc4 commit a1234da

File tree

3 files changed

+44
-23
lines changed

3 files changed

+44
-23
lines changed

README.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Supported extensions ( jpg , jpeg , gif , png , svg , webp , bmp ) .
6868

6969
Max file size : 16MB .
7070

71-
Max Base64 length : 2,000,000
71+
Max Base64 length : 10,000,000
7272

7373
* **$nocache** : default false
7474

@@ -85,22 +85,50 @@ $referenceId="SDK";
8585
$nocache=false;
8686
$api=$client->sendImageMessage($to,$image,$caption,$priority,$referenceId,$nocache);
8787
print_r($api);
88+
89+
```
90+
## Send Sticker
91+
* **$sticker** : HTTP link image or base64-encoded file
92+
93+
Supported extensions ( jpg , jpeg , gif , png , svg , webp , bmp ) .
94+
95+
Max file size : 16MB .
96+
97+
Max Base64 length : 10,000,000
98+
99+
* **$nocache** : default false
100+
101+
false : use a previously uploaded file instead of uploading it with each request
102+
103+
true : uploading it each request
104+
105+
```php
106+
$to="put_your_mobile_number_here";
107+
$sticker="https://file-example.s3-accelerate.amazonaws.com/images/test.jpg";
108+
$priority=10;
109+
$referenceId="SDK";
110+
$nocache=false;
111+
$api=$client->sendStickerMessage($to,$sticker,$priority,$referenceId,$nocache);
112+
print_r($api);
88113
```
114+
89115
## Send Document
90116
* **$filename** : File name, for example 1.jpg or Hello.pdf
117+
* **$caption** : Document Caption, UTF-8 or UTF-16 string with emoji .
91118
* **$document** : HTTP link file or base64-encoded file
92119

93120
Supported most extensions like ( zip , xlsx , csv , txt , pptx , docx ....etc ) .
94121

95122
Max file size : 100MB .
96123

97-
Max Base64 length : 2,000,000
124+
Max Base64 length : 10,000,000
98125

99126
```php
100127
$to="put_your_mobile_number_here";
101-
$filename="image Caption";
128+
$filename="File name";
129+
$caption="Document Caption";
102130
$document="https://file-example.s3-accelerate.amazonaws.com/documents/cv.pdf";
103-
$api=$client->sendDocumentMessage($to,$filename,$document);
131+
$api=$client->sendDocumentMessage($to,$filename,$document,$caption);
104132
print_r($api);
105133
```
106134

@@ -111,7 +139,7 @@ Supported extensions ( mp3 , aac , ogg ) .
111139

112140
Max file size : 16MB .
113141

114-
Max Base64 length : 2,000,000
142+
Max Base64 length : 10,000,000
115143

116144
```php
117145
$to="put_your_mobile_number_here";
@@ -124,7 +152,7 @@ print_r($api);
124152

125153
Max file size : 16MB .
126154

127-
Max Base64 length : 2,000,000
155+
Max Base64 length : 10,000,000
128156

129157
```php
130158
$to="put_your_mobile_number_here";
@@ -140,7 +168,7 @@ Supported extensions ( mp4 , 3gp , mov ) .
140168

141169
Max file size : 16MB .
142170

143-
Max Base64 length : 2,000,000
171+
Max Base64 length : 10,000,000
144172

145173
```php
146174
$to="put_your_mobile_number_here";
@@ -297,18 +325,7 @@ print_r($api);
297325
$api=$client->getInstanceQrCode();
298326
print_r($api);
299327
```
300-
## Get Instance Screenshot
301-
302-
```php
303-
header('Content-Type: image/png');
304-
$api=$client->getInstanceScreenshot();
305-
print_r($api);
306-
```
307-
or base64
308-
```php
309-
$api=$client->getInstanceScreenshot("base64");
310-
print_r($api);
311-
```
328+
312329
## Get Instance Info
313330
Get connected phone informations : number , name , image etc..
314331
```php
@@ -456,4 +473,4 @@ print_r($api);
456473

457474

458475
# Support
459-
Use **Issues** to contact me
476+
Use **Issues** to contact me

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"url": "https://github.com/ultramsg/whatsapp-php-sdk"
1616
}
1717
],
18-
"version": "2.0.7",
18+
"version": "2.0.8",
1919
"license": "MIT",
2020
"authors": [
2121
{

ultramsg.class.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ public function sendImageMessage($to,$image,$caption="",$priority=10,$referenceI
4040
$params =array("to"=>$to,"caption"=>$caption,"image"=>$image,"priority"=>$priority,"referenceId"=>$referenceId,"nocache"=>$nocache);
4141
return $this->sendRequest("POST","messages/image",$params );
4242
}
43+
public function sendStickerMessage($to,$sticker,$priority=10,$referenceId="",$nocache=false){
44+
$params =array("to"=>$to,"sticker"=>$sticker,"priority"=>$priority,"referenceId"=>$referenceId,"nocache"=>$nocache);
45+
return $this->sendRequest("POST","messages/sticker",$params );
46+
}
4347

44-
public function sendDocumentMessage($to,$filename,$document,$priority=10,$referenceId="",$nocache=false){
45-
$params =array("to"=>$to,"filename"=>$filename,"document"=>$document,"priority"=>$priority,"referenceId"=>$referenceId,"nocache"=>$nocache);
48+
public function sendDocumentMessage($to,$filename,$document,$caption="",$priority=10,$referenceId="",$nocache=false){
49+
$params =array("to"=>$to,"filename"=>$filename,"document"=>$document,"caption"=>$caption,"priority"=>$priority,"referenceId"=>$referenceId,"nocache"=>$nocache);
4650
return $this->sendRequest("POST","messages/document",$params );
4751
}
4852

0 commit comments

Comments
 (0)