whatsapp@1.0.3
This adaptor exports the following from common:
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- group()
- lastReferenceValue()
- merge()
- scrubEmojis()
- sourceValue()
- util
Functions
request
request(method, path, body, options) ⇒ Operation
Make a HTTP request to the WhatsApp base URL, guided by the configuration
Param | Type | Description |
---|---|---|
method | string | HTTP method to use |
path | string | Path to resource |
body | object | Object which will be attached to the request body |
options | RequestOptions | Additional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
Example: Send a whatsapp message
request(
'POST',
'messages',
{
to: '254712345678',
body: 'Hello, world!',
type: 'template',
template: {
name: 'hello_world',
language: { code: 'en_US' }
},
messaging_product: 'whatsapp'
});
Interfaces
HttpState
State object
Properties
Name | Description |
---|---|
data | the parsed response body |
response | the response from the HTTP server, including headers, statusCode, body, etc |
references | an array of all previous data objects used in the Job |
RequestOptions
Options provided to the HTTP request
Properties
Name | Type | Description |
---|---|---|
body | object | string | body data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request). |
errors | object | Map of errorCodes -> error messages, ie, { 404: 'Resource not found;' } . Pass false to suppress errors for this code. |
form | object | Pass a JSON object to be serialised into a multipart HTML form (as FormData) in the body. |
query | object | An object of query parameters to be encoded into the URL. |
headers | object | An object of headers to append to the request. |
parseAs | string | Parse the response body as json, text or stream. By default will use the response headers. |
timeout | number | Request timeout in ms. Default: 300 seconds. |
tls | object | TLS/SSL authentication options. See https://nodejs.org/api/tls.html#tlscreatesecurecontextoptions |