with Reviews.io and Odoo?
The Reviews.io API allows for automated management and retrieval of review data from the Reviews.io platform. Within Pipedream, you can leverage this API to build serverless workflows that trigger on specific events, integrate with other services, manipulate and analyze review data, and automate responses or notifications. By tapping into Reviews.io via Pipedream, businesses can enhance their customer feedback loop, monitor their reputation, and engage with their reviewers efficiently.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
reviews_io: {
type: "app",
app: "reviews_io",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://api.reviews.io/product/invitations`,
headers: {
"Accept": `application/json`,
"Content-Type": `application/json`,
},
params: {
store: `${this.reviews_io.$auth.store_id}`,
apikey: `${this.reviews_io.$auth.api_key}`,
},
})
},
})
import xmlrpc from 'xmlrpc';
export default defineComponent({
props: {
odoo: {
type: "app",
app: "odoo",
}
},
async run({ steps, $ }) {
const url = this.odoo.$auth.server_url;
const db = this.odoo.$auth.db;
const username = this.odoo.$auth.username;
const password = this.odoo.$auth.password;
// Create clients for common and object endpoints
const common = xmlrpc.createSecureClient(`${url}/xmlrpc/2/common`);
const models = xmlrpc.createSecureClient(`${url}/xmlrpc/2/object`);
// Using async/await with promises
async function getFields() {
try {
// Authenticate and get uid
const uid = await new Promise((resolve, reject) => {
common.methodCall('authenticate', [db, username, password, {}], (error, value) => {
if (error) reject(error);
resolve(value);
});
});
// Get fields
const results = await new Promise((resolve, reject) => {
models.methodCall('execute_kw', [
db,
uid,
password,
'res.partner',
'fields_get',
[],
{ 'attributes': ['string', 'help', 'type'] }
], (error, value) => {
if (error) reject(error);
resolve(value);
});
});
return results;
} catch (error) {
throw new Error(error);
}
}
return await getFields();
},
})