Auto create google groups from sheets - google-apps

Searched the net, youtube, and google forums/documentation but can't seem to find this one even if it is possible.
I'm using a google form as a starting point for a workflow that then gets turned into a google group. Is there any scripts that can auto create a google group from the google forms output in sheets once form is submitted?
Thanks in advance.

I haven't tested this yet, so just give it a try. This is what I've found. Directory API let's you create a group by making a POST URI request:
https://www.googleapis.com/admin/directory/v1/groups
with request body:
{
"email": "sales_group#example.com",
"name": "Sales Group",
"description": "This is the Sales group."
}
Since you are using Google Forms, the option would be to use AppScript to perform the XHR request.
Try to make use of Class UrlFetchApp in Appscript.
var options =
{
"method" : "post",
"payload" : payload
};
UrlFetchApp.fetch("http://example.com/upload_form.cgi", options);

Related

how to create a custom profile in salesforce using rest api

Am experimenting with salesforce apis by creating and patching with its api services.I dont know how to create a custom profile with the help of its apis and also i dont know what are all the required body parameters to create a profile. i tried sending a post request with the following body
{
"Name" : "testprofile"
}
to the url /services/data/v54.0/sobjects/Profile
i got this message as response
{
"message": "insufficient access rights on cross-reference id",
"errorCode": "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY",
"fields": []
}
i reffered https://developer.salesforce.com/docs/atlas.en-us.234.0.object_reference.meta/object_reference/sforce_api_objects_profile.htm
havent got any eloborate writings on what should be in the body while using post request.. but it says create() methods are allowed
It seems that i have to add user license with the body along with the name for the post to scceeded once added it should look like this
{
"Name":"profilename",
"UserLicenseId": "license id"
}
and thus made the request work

How can I use marketing email templates with an API request?

I'm trying to set up an API request for Dynamics 365 to send an email template to a specific user, and I am having a lot of difficulty getting it to do what I want.
I'm using the SendEmailFromTemplate action and so far only have access to global templates. Whenever I try to use a marketing email template, it says it's not found. Is it even possible for me to use Marketing email templates with this action?
Response
"error": {
"code": "0x80040217",
"message": "template With Id = 41deb0fa-c108-eb11-a813-000d3a8c09cf Does Not Exist"
}
Additionally, I've not been able to embed user data in the global templates such as {{contact.address1_city}}.
Current request:
{
"TemplateId": "TEMPLATE-ID",
"Regarding": {
"contactid": "CONTACT-ID",
"#odata.type": "Microsoft.Dynamics.CRM.contact"
},
"Target": {
"regardingobjectid_contact#odata.bind": "/contacts(CONTACT-ID)",
"email_activity_parties": [{
"partyid_systemuser#odata.bind": "/systemusers(SYSTEMUSER-ID)",
"participationtypemask": 1
}, {
"partyid_contact#odata.bind": "/contacts(CONTACT-ID))",
"participationtypemask": 2
}],
"#odata.type": "Microsoft.Dynamics.CRM.email"
}
}
I might be going about it the wrong way. Any assistance is appreciated.
Thanks!
No this is not supported.
Marketing emails and CDS emails are two separate things - both business-wise and technically. Marketing emails are meant for sending emails in business to business and business to customer scenarios and are part of marketing solution. CDS emails are piece of core functionality.
If you do want to send marketing email your best shot is to use "quick send" instead.

How to wrap an existing chatbot for Google Assistant (Google Home)

We have a chatbot for our website today, that is not build using Google technology. The bot has a JSON REST API where you can send the question to and which replies with the corresponding answers. So all the intents and entities are being resolved by the existing chatbot.
What is the best way to wrap this functionality in Google Assistant / for Google Home?
To me it seems I need to extract the "original" question from the JSON that is send to our webservice (when I enable fullfilment).
But since context is used to exchange "state" I have to find a way to exchange the context between the dialogflow and our own chatbot (see above).
But maybe there are other ways ? Can it (invoke our chatbot) be done directly (without DialogFlow as man in the middle) ?
This is one of the those responses that may not be enough for someone who doesn't know what I am talking about and too much for someone who does. Here goes:
It sounds to me as if you need to build an Action with the Actions SDK rather than with Dialog flow. Then you implement a text "intent" in your Action - i.e. one that runs every time the user speaks something. In that text intent you ask the AoG platform for the text - see getRawInput(). Now you do two things. One, you take that raw input and pass it to your bot. Two, you return a promise to tell AoG that you are working on a reply but you don't have it yet. Once the promise is fulfilled - i.e. when your bot replies - you reply with the text you got from your bot.
I have a sample Action called the French Parrot here https://github.com/unclewill/french_parrot. As far as speech goes it simply speaks back whatever it hears as a parrot would. It also goes to a translation service to translate the text and return the (loose) French equivalent.
Your mission, should you choose to accept it, is to take the sample, rip out the code that goes to the translation service and insert the code that goes to your bot. :-)
Two things I should mention. One, it is not "idiomatic" Node or JavaScript you'll find in my sample. What can I say - I think the rest of the world is confused. Really. Two, I have a minimal sample of about 50 lines that eschews the translation here https://github.com/unclewill/parrot. Another option is to use that as a base and add code to call your bot and the Promise-y code to wait on it to it.
If you go the latter route remove the trigger phrases from the action package (action.json).
So you already have a Backend that process user inputs and sends responses back and you want to use it to process a new input flow (coming from Google Assistant)?
That actually my case, I've a service as a Facebook Messenger ChatBot and recently started developing a Google Home Action for it.
It's quite simple. You just need to:
Create an action here https://console.actions.google.com
Download GActions-Cli from here https://developers.google.com/actions/tools/gactions-cli
Create a JSON file action.[fr/en/de/it].json (choose a language). The file is your mean to define your intents and the URL to your webhook (a middleware between your backend and google assistant). It may look like this:
{
"locale": "en",
"actions": [
{
"name": "MAIN",
"description": "Default Welcome Intent",
"fulfillment": {
"conversationName": "app name"
},
"intent": {
"name": "actions.intent.MAIN",
"trigger": {
"queryPatterns": [
"Talk to app name"
]
}
}
}
],
"conversations": {
"app name": {
"name": "app name",
"url": "https://your_nodejs_middleware.com/"
}
}
}
Upload the JSON file using gactions update --action_package action.en.json --project PROJECT_ID
AFAIK, there only a Node.js client library for Actions-on-google https://github.com/actions-on-google/actions-on-google-nodejs that why you need a Node.js middleware before hitting your backend
Now, user inputs will be sent to your Node.js middleware (app.js) hosted at https://your_nodejs_middleware.com/ which may look like:
//require express and all required staff to build a Node.js server,
//look on internet how to build a simple web server in Node.js
//if you a new to this domain. const {
ActionsSdkApp } = require('actions-on-google');
app.post('/', (req, res) => {
req.body = JSON.parse(req.body);
const app = new ActionsSdkApp({
request: req,
response: res
});
// Create functions to handle requests here
function mainIntent(app) {
let inputPrompt = app.buildInputPrompt(false,
'Hey! Welcome to app name!');
app.ask(inputPrompt);
}
function respond(app) {
let userInput = app.getRawInput();
//HERE you get what user typed/said to Google Assistant.
//NOW you can send the input to your BACKEND, process it, get the response_from_your_backend and send it back
app.ask(response_from_your_backend);
}
let actionMap = new Map();
actionMap.set('actions.intent.MAIN', mainIntent);
actionMap.set('actions.intent.TEXT', respond);
app.handleRequest(actionMap); });
Hope that helped!
Thanks for all the help, the main parts of the solution are already given, but I summarize them here
action.json that passes on everything to fullfilment service
man in the middle (in my case IBM Cloud Function) to map JSON between services
Share context/state through the conversationToken property
You can find the demo here: Hey Google talk to Watson

How to set the tracking_specs when creating Facebook ads?

I am trying to create an ad using the Facebook Marketing API. In order to create an ad inside a conversion based campaign, I am required to set proper tracking_specs values.
Querying existing ads (on other similar campaigns) I see the tracking spec is generally defined as follows:
"tracking_specs": [
{
"action.type": ["offsite_conversion"],
"fb_pixel": [<pixel ID>]
},
{
"action.type": ["post_engagement"],
"page": [<page ID>],
"post": [<post ID>]
},
{
"action.type": ["link_click"],
"post": [<post ID>],
"post.wall": [<post.wall ID>]
}
]
How do I find the required tracking_specs values? More specifically, how do I find the post ID and the post.wall ID accordingly for post_engagement and link_click action types?
I managed to figure it out on my own. When creating a new ad, in a conversion typed campaign, an ad data object that includes tracking specs should be provided. These tracking specs should include some reference to a Facebook pixel.
"tracking_specs": [
{
"action.type": ["offsite_conversion"],
"fb_pixel": [<pixel ID>]
},
]
The pixels data can be obtained manually via the Facebook Business Manager or via the Facebook Marketing APIs:
GET /v2.10/{ad-account-id}/adspixels HTTP/1.1
Host: graph.facebook.com
Read more in https://developers.facebook.com/docs/marketing-api/reference/ad-account/adspixels/
Regarding the post and post.wall IDs - these are automatically added by Facebook when the ad is created. So there is no need to include theses when creating the ad.
For anyone searching for an answer in 2023. asaf's answer is totally correct BUT you also need to wait until Meta Business Manager processes your campaign in order to see tracking_specs into the API and in the Business Manager itself.

Facebook publish to stream and attach link

I'm currently using the Facebook Developer Toolkit to publish to my organization's Facebook page. I'd like to be able to attach a link, but can't quite seem to figure out the syntax. Here's what I'm trying.
ConnectSession fbSession = new ConnectSession(API_KEY, API_SECRET);
Api fbApi = new Api(fbSession);
attachment attach = new attachment();
attach.href = "http://www.google.com";
attach.caption = "Google";
attach.name = "Google";
String post = "Here's a cool new search engine I found!";
fbApi.Stream.Publish(post, attach, null, null, Convert.ToInt64(fanPageId));
Here's what I'm going for:
Don't use that the Facebook Developer Toolkit because it's not being properly supported (personal opinion :P) use the FacebookC#SDK
What you want to post are referred to as 'action_links' and can only be posted using the OLD REST API, not the new graph api (https://api.facebook.com/method/stream.publish)
In order to post it you need to encode the JSON in the form:
action_links: [
{ text: "TITLE", href: "LINK"}
]