@appflows/appflows
v1.1.7
Published
AppFlows is a low-code tool that helps you create smarter and more behavior-driven email automations for your product.
Downloads
10
Readme
AppFlows
AppFlows is a low-code tool that helps you create smarter and more behavior-driven email automations for your product.
Visit us here at https://dashboard.appflows.com to create an account!
Installing
Npm
npm i @appflows/appflows
Features
- Hyper Personalization: Personalize user experience with behavior-driven targeted emails.
- Real-time Messaging: Engage with your customers at the right time in the user journey.
- User Data and Insights: Deep dive into data and see how your users are interacting with the app.
Setting up the Client
To set up the client, you will need your API_KEY and SITE_ID.
The SITE_ID will be assigned to you automatically while setting up the account. This id will be a numeric value. Moreover, you can also extract this value from the page url **_dashboard.appflows.com/sites/siteId***
For the API_KEY, you will be asked to manually generate this key while setting up your account. This will be an alpha-numeric string with hyphens in between.
Used along with the SITE_ID for communication, note and save the API_KEY in a secure place and share it with no one as it is confidential.
import { Client } from @appflows/appflows
const AppFlowsClient = new Client({
apiKey: process.env.APPFLOWS_API_TOKEN
siteId: process.env.APPFLOWS_SITE_ID
})
//You will now be able to call the methods provided @appflows/appflows package
//The following method will create a new user for you
AppFlowsClient.createContact({
email: "[email protected]",
list_id: 1024,
})
//export to use it throughout your code :)
export default AppFlowsClient
API Methods
You can use the following methods exposed for communicating the Appflows API
Contacts
The Contacts endpoint will help you manage your contacts. It provides the basic CRUD functionalities like create, get, update and delete.
createContact()
Params:
| Name | Type | Required |
| ------ | ------ | ------ |
| email | string | TRUE |
| list_id | number | FALSE
| custom_fields | object | FALSE
Response:
| Name | Type | Example | | ------------------- | ------ | ----------------------------------------------- | | site_id | number | 3581983 | | email | string | [email protected] | | list_id | number | 98391 | | created_at | string | 2022-06-22T06:55:54.192Z | | updated_at | string | 2022-06-22T06:55:54.192Z | | subscription_status | string | active, cold, unconfirmed, unsubscribed, failed | | unsubscribe_message | string | "Unsubscribed from the email" | | custom_fields | object | custom_fields: { "company": "XYZ Company" } |
getContact()
Params:
| Name | Type | Required |
| ------ | ------ | ------ |
| id | number | TRUE |
Response:
| Name | Type | Example | | ------------------- | ------ | ----------------------------------------------- | | site_id | number | 3581983 | | email | string | [email protected] | | list_id | number | 98391 | | created_at | string | 2022-06-22T06:55:54.192Z | | updated_at | string | 2022-06-22T06:55:54.192Z | | subscription_status | string | active, cold, unconfirmed, unsubscribed, failed | | unsubscribe_message | string | null | | custom_fields | object | custom_fields: { "first_name": "John" } |
updateContact()
Params:
| Name | Type | Required |
| ------ | ------ | ------ |
| email | string | TRUE |
| list_id | number | FALSE
| custom_fields | object | FALSE
Response:
| Name | Type | Example | | ------------------- | ------ | ----------------------------------------------- | | site_id | number | 3581983 | | email | string | [email protected] | | list_id | number | 98391 | | created_at | string | 2022-06-22T06:55:54.192Z | | updated_at | string | 2022-06-22T06:55:54.192Z | | subscription_status | string | active, cold, unconfirmed, unsubscribed, failed | | unsubscribe_message | string | null | | custom_fields | object | custom_fields: { "first_name": "Doe" } |
deleteContact()
Params:
| Name | Type | Required |
| ------ | ------ | ------ |
| email | string | TRUE |
Response:
| Name | Type | Value | | ------- | ------ | ------------------------------ | | message | string | "Contact deleted successfully" |
Events
The Events endpoint will allow you to trigger events for your contacts. Based on these events, you can send emails to these contacts and do multiple other actions using our Automation Builder.
logEvent()
Params:
| Name | Type | Required |
| ------ | ------ | ------ |
| name | string | TRUE |
| contact.email | string | TRUE |
| contact.list_id | number | FALSE |
| contact.custom_fields | object | FALSE |
Response:
| Name | Type | Value | | ------- | ------- | ----------- | | success | boolean | true, false |
Default Custom Fields
By default, we provide the following custom fields. These can be used for storing custom data.
You can pass the custom_fields object body parameters while making a request as shown below,
{
name: 'your_event_name',
contact: {
email: "[email protected]",
list_id: 1024,
custom_fields: {
first_name: "John",
last_name: "Doe",
company: "John's Company",
zip_code: "12000"
}
}
}
| Name | Slug | | ------------ | ------------ | | Email | email | | Name | name | | First Name | first_name | | Last Name | last_name | | Phone Number | phone_number | | Company | company | | Website | website | | Zip Code | zip_code |
Further Documentation
For further API Reference, please visit
https://appflows.readme.io/reference/getting-started