1 | # Client
|
2 |
|
3 | ## Events
|
4 |
|
5 | ### message
|
6 | Emitted whenever a message is sent
|
7 |
|
8 | | Parameter | Type | Description |
|
9 | |:-------------------------------|:------------------|:---------------------|
|
10 | | message | [Message](message.md) | Message is sent |
|
11 |
|
12 | ### postback
|
13 | Emitted whenever a postback (can be a quick_reply witch a payload) is sent
|
14 |
|
15 | | Parameter | Type | Description |
|
16 | |:-------------------------------|:------------------|:---------------------|
|
17 | | postback | [Postback](postback.md) | Postback is sent |
|
18 |
|
19 | ## Methods
|
20 |
|
21 | ### typing
|
22 | Toggles the typing action
|
23 |
|
24 | | Parameter | Type | Description |
|
25 | |:-------------------------------|:------------------|:---------------------|
|
26 | | sender_id | ID | The ID of the sender |
|
27 | | toggle | Boolean | Default: true - Toggles the typing |
|
28 |
|
29 | **Returns:** Promise
|
30 |
|
31 | ### send
|
32 | Sends a message/object to the recipient
|
33 |
|
34 | | Parameter | Type | Description |
|
35 | |:-------------------------------|:------------------|:---------------------|
|
36 | | recipient | String | Ex: "14335981239" |
|
37 | | data | Any | Data to post |
|
38 | | options | Object | Optional: Merges with data |
|
39 |
|
40 | **Returns:** Promise
|
41 |
|
42 | ### sendAttachment
|
43 | Sends an attachment to the recipient
|
44 |
|
45 | | Parameter | Type | Description |
|
46 | |:-------------------------------|:------------------|:---------------------|
|
47 | | recipient | String | Ex: "14335981239" |
|
48 | | type | String | Attachment type ("image", "audio", "video", "file) |
|
49 | | url | String | URL of attachment |
|
50 |
|
51 | **Returns:** Promise
|
52 |
|
53 | ### sendImage
|
54 | Sends an image to the recipient
|
55 |
|
56 | | Parameter | Type | Description |
|
57 | |:-------------------------------|:------------------|:---------------------|
|
58 | | recipient | String | Ex: "14335981239" |
|
59 | | url | String | URL of the image |
|
60 |
|
61 | **Returns:** Promise
|
62 |
|
63 | ### sendAudio
|
64 | Sends an audio to the recipient
|
65 |
|
66 | | Parameter | Type | Description |
|
67 | |:-------------------------------|:------------------|:---------------------|
|
68 | | recipient | String | Ex: "14335981239" |
|
69 | | url | String | URL of the audio |
|
70 |
|
71 | **Returns:** Promise
|
72 |
|
73 | ### sendVideo
|
74 | Sends a video to the recipient
|
75 |
|
76 | | Parameter | Type | Description |
|
77 | |:-------------------------------|:------------------|:---------------------|
|
78 | | recipient | String | Ex: "14335981239" |
|
79 | | url | String | URL of the video |
|
80 |
|
81 | **Returns:** Promise
|
82 |
|
83 | ### sendFile
|
84 | Sends a file to the recipient
|
85 |
|
86 | | Parameter | Type | Description |
|
87 | |:-------------------------------|:------------------|:---------------------|
|
88 | | recipient | String | Ex: "14335981239" |
|
89 | | url | String | URL of the file |
|
90 |
|
91 | **Returns:** Promise
|
92 |
|
93 | ### post
|
94 | Sends a raw post to the graphql api
|
95 |
|
96 | | Parameter | Type | Description |
|
97 | |:-------------------------------|:------------------|:---------------------|
|
98 | | endpoint | String | Ex: "me/messages" |
|
99 | | data | Object | Data to post |
|
100 |
|
101 | **Returns:** Promise
|
102 |
|
103 | ### get
|
104 | Gets a raw request from the graphql api
|
105 |
|
106 | | Parameter | Type | Description |
|
107 | |:-------------------------------|:------------------|:---------------------|
|
108 | | endpoint | String | Ex: "me/messages" |
|
109 |
|
110 | **Returns:** Promise |
\ | No newline at end of file |