RD Station Javascript library for API integration
Single lib to allow RDStation integration on Javascript ES2015 projects.
Installation
npm install rdstation
Conversion via API KEY
For the simple conversion you can use the conversion with the api key, with no need to do the authentication process as needed for the others resources.
; const conversion = apikey;conversion
Authentication
RDStations states on developer documentation:
Step 1:
Create an app on the RD Station App Store
Step 2:
Replace the URL fields below with the data you will get from the application.
https://api.rd.services/auth/dialog?client_id={client_id}&redirect_url={redirect_url}
Step 3:
Click on the link and log in to RD Station Marketing.
Step 4:
After login and confirmation of access, we will send the code to the callback URL.
Step 5:
Request access_token
andrefresh_token
from the generated code
, sending a request to our API.
Passo 6:
Ready! You can now send data to our API with the access_token
received.
Features
- Contacts: class to work with RDStation Contact resource (the core Contact central resource)
- Events: class to work with RDStation Event resource (opportunities, ecommerce carts, chats, etc)
- Funnels: class to work with RDStation Funnel resource
Library Resources
Contacts
RDStation Developer documentation:
https://developers.rdstation.com/pt-BR/reference/contacts
; const clientId = 'Your RDStation app client id';const clientSecret = 'Your RDStation app client secret';const authCode = 'Code returned on callback' const auth = clientId clientSecret;const accessToken = auth; const contact = accessToken; // Get by UUIDlet response = contact; // Get by Emaillet response = contact; // Update a contact (by UUID)let response = contact; // Upsert a contact (bt UUID identifier)let response = contact; // Upsert a contact (by email identifier)let response = contact;
Funnels
RDStation Developer documentation:
https://developers.rdstation.com/pt-BR/reference/contacts/funnels
; const clientId = 'Your RDStation app client id';const clientSecret = 'Your RDStation app client secret';const authCode = 'Code returned on callback' const auth = clientId clientSecret;const accessToken = auth; const funnel = accessToken; // Get funnels by UUIDlet response = funnel; // Get funnels by Emaillet response = funnel; // Update funnel by UUIDlet response = funnel; // Update funnel by contact emaillet response = funnel;
Events
RDStation Developer documentation:
https://developers.rdstation.com/pt-BR/reference/events
; const clientId = 'Your RDStation app client id';const clientSecret = 'Your RDStation app client secret';const authCode = 'Code returned on callback' const auth = clientId clientSecret;const accessToken = auth; const event = accessToken; // Basic conversionslet response = event; // Opportunitylet response = event; // Opportunity Won (Sale)let response = event; // Opportuniy lostlet response = event; // Order placed (Ecommerce order)let response = event; // Order specific item placedlet response = event; // Cart abandonedlet response = event; // Cart abandoned itemlet response = event; // Chat startedlet response = event->; // Chart finishedlet response = event->;
License
MIT License
Copyright (c) 2020 Glauber Portella
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
TODO
- Needs automated tests
- Add other types of resources
- Please help improve