with Odoo and Google Business Profile?
Emit new event for each new local post on a location See the documentation
Emit new event for each new review on a location See the documentation
Create or update a reply to the specified review. See the documentation
Create a new local post associated with a location. See the documentation
List local posts associated with a location. See the documentation
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();
},
})
The Google My Business API enables businesses to manage their online presence across Google, including Search and Maps. Through Pipedream, you can automate various aspects of your Google My Business account, such as reading and responding to customer reviews, updating business information, and posting new content. This API provides a powerful way to engage with customers and maintain accurate, up-to-date business listings, all through programmable interactions that can save time and enhance visibility.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
google_my_business: {
type: "app",
app: "google_my_business",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://mybusinessaccountmanagement.googleapis.com/v1/accounts`,
headers: {
Authorization: `Bearer ${this.google_my_business.$auth.oauth_access_token}`,
},
})
},
})