403 on Google Action push notification request





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







4















I'm trying to perform a push notification for Google Actions Intent.



Thus far, I've followed the instructions here: https://developers.google.com/actions/assistant/updates/notifications#send_notifications



This is my resulting code:



const {google} = require('googleapis');
var request = require('request');

const key = require('./bot.json');

module.exports = async function (context, myQueueItem) {
context.log('JavaScript queue trigger function processed work item', myQueueItem);

let jwtClient = new google.auth.JWT(
key.client_email, null, key.private_key,
['https://www.googleapis.com/auth/actions.fulfillment.conversation'],
null
);

jwtClient.authorize((err, tokens) => {
// code to retrieve target userId and intent
let notif = {
userNotification: {
title: [message],
},
target: {
userId:[obtained from permission request],
intent: [name of intent],
// Expects a IETF BCP-47 language code (i.e. en-US)
locale: 'en-US'
},
};

request.post('https://actions.googleapis.com/v2/conversations:send', {
'auth': {
'bearer': tokens.access_token,
},
'json': true,
'body': {'customPushMessage': notif},
}, (err, httpResponse, body) => {
console.log(body);
console.log(httpResponse.statusCode + ': ' + httpResponse.statusMessage);
});
});
};

//module.exports(console, "Test");


This results in a 403 from the notification service. Is this because of the user id, intent name or jwtoken that was generated?










share|improve this question























  • Have you enabled Would you like to send push notifications in User Engagement for your intent in your Actions Console ?

    – sai.raj
    Nov 24 '18 at 3:48











  • Yep, I had enabled it in User Engagement.

    – Irwin
    Nov 24 '18 at 4:21











  • do you get a 403 all the time? there is a 1 notifications per user per minute limit when sending notifications. do you get any error messages?

    – Reza Nasiri
    Nov 25 '18 at 0:07











  • yep. 100% failures

    – Irwin
    Nov 25 '18 at 1:29











  • Have you enabled the Actions API for your project? Go to the Google Cloud Platform console to activate the Actions API, and select the project that you have created on the Actions on Google console. Then, click the Enable button.

    – Taylor Caldwell
    Nov 26 '18 at 20:41


















4















I'm trying to perform a push notification for Google Actions Intent.



Thus far, I've followed the instructions here: https://developers.google.com/actions/assistant/updates/notifications#send_notifications



This is my resulting code:



const {google} = require('googleapis');
var request = require('request');

const key = require('./bot.json');

module.exports = async function (context, myQueueItem) {
context.log('JavaScript queue trigger function processed work item', myQueueItem);

let jwtClient = new google.auth.JWT(
key.client_email, null, key.private_key,
['https://www.googleapis.com/auth/actions.fulfillment.conversation'],
null
);

jwtClient.authorize((err, tokens) => {
// code to retrieve target userId and intent
let notif = {
userNotification: {
title: [message],
},
target: {
userId:[obtained from permission request],
intent: [name of intent],
// Expects a IETF BCP-47 language code (i.e. en-US)
locale: 'en-US'
},
};

request.post('https://actions.googleapis.com/v2/conversations:send', {
'auth': {
'bearer': tokens.access_token,
},
'json': true,
'body': {'customPushMessage': notif},
}, (err, httpResponse, body) => {
console.log(body);
console.log(httpResponse.statusCode + ': ' + httpResponse.statusMessage);
});
});
};

//module.exports(console, "Test");


This results in a 403 from the notification service. Is this because of the user id, intent name or jwtoken that was generated?










share|improve this question























  • Have you enabled Would you like to send push notifications in User Engagement for your intent in your Actions Console ?

    – sai.raj
    Nov 24 '18 at 3:48











  • Yep, I had enabled it in User Engagement.

    – Irwin
    Nov 24 '18 at 4:21











  • do you get a 403 all the time? there is a 1 notifications per user per minute limit when sending notifications. do you get any error messages?

    – Reza Nasiri
    Nov 25 '18 at 0:07











  • yep. 100% failures

    – Irwin
    Nov 25 '18 at 1:29











  • Have you enabled the Actions API for your project? Go to the Google Cloud Platform console to activate the Actions API, and select the project that you have created on the Actions on Google console. Then, click the Enable button.

    – Taylor Caldwell
    Nov 26 '18 at 20:41














4












4








4


1






I'm trying to perform a push notification for Google Actions Intent.



Thus far, I've followed the instructions here: https://developers.google.com/actions/assistant/updates/notifications#send_notifications



This is my resulting code:



const {google} = require('googleapis');
var request = require('request');

const key = require('./bot.json');

module.exports = async function (context, myQueueItem) {
context.log('JavaScript queue trigger function processed work item', myQueueItem);

let jwtClient = new google.auth.JWT(
key.client_email, null, key.private_key,
['https://www.googleapis.com/auth/actions.fulfillment.conversation'],
null
);

jwtClient.authorize((err, tokens) => {
// code to retrieve target userId and intent
let notif = {
userNotification: {
title: [message],
},
target: {
userId:[obtained from permission request],
intent: [name of intent],
// Expects a IETF BCP-47 language code (i.e. en-US)
locale: 'en-US'
},
};

request.post('https://actions.googleapis.com/v2/conversations:send', {
'auth': {
'bearer': tokens.access_token,
},
'json': true,
'body': {'customPushMessage': notif},
}, (err, httpResponse, body) => {
console.log(body);
console.log(httpResponse.statusCode + ': ' + httpResponse.statusMessage);
});
});
};

//module.exports(console, "Test");


This results in a 403 from the notification service. Is this because of the user id, intent name or jwtoken that was generated?










share|improve this question














I'm trying to perform a push notification for Google Actions Intent.



Thus far, I've followed the instructions here: https://developers.google.com/actions/assistant/updates/notifications#send_notifications



This is my resulting code:



const {google} = require('googleapis');
var request = require('request');

const key = require('./bot.json');

module.exports = async function (context, myQueueItem) {
context.log('JavaScript queue trigger function processed work item', myQueueItem);

let jwtClient = new google.auth.JWT(
key.client_email, null, key.private_key,
['https://www.googleapis.com/auth/actions.fulfillment.conversation'],
null
);

jwtClient.authorize((err, tokens) => {
// code to retrieve target userId and intent
let notif = {
userNotification: {
title: [message],
},
target: {
userId:[obtained from permission request],
intent: [name of intent],
// Expects a IETF BCP-47 language code (i.e. en-US)
locale: 'en-US'
},
};

request.post('https://actions.googleapis.com/v2/conversations:send', {
'auth': {
'bearer': tokens.access_token,
},
'json': true,
'body': {'customPushMessage': notif},
}, (err, httpResponse, body) => {
console.log(body);
console.log(httpResponse.statusCode + ': ' + httpResponse.statusMessage);
});
});
};

//module.exports(console, "Test");


This results in a 403 from the notification service. Is this because of the user id, intent name or jwtoken that was generated?







jwt actions-on-google






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 23 '18 at 15:31









IrwinIrwin

7,079105781




7,079105781













  • Have you enabled Would you like to send push notifications in User Engagement for your intent in your Actions Console ?

    – sai.raj
    Nov 24 '18 at 3:48











  • Yep, I had enabled it in User Engagement.

    – Irwin
    Nov 24 '18 at 4:21











  • do you get a 403 all the time? there is a 1 notifications per user per minute limit when sending notifications. do you get any error messages?

    – Reza Nasiri
    Nov 25 '18 at 0:07











  • yep. 100% failures

    – Irwin
    Nov 25 '18 at 1:29











  • Have you enabled the Actions API for your project? Go to the Google Cloud Platform console to activate the Actions API, and select the project that you have created on the Actions on Google console. Then, click the Enable button.

    – Taylor Caldwell
    Nov 26 '18 at 20:41



















  • Have you enabled Would you like to send push notifications in User Engagement for your intent in your Actions Console ?

    – sai.raj
    Nov 24 '18 at 3:48











  • Yep, I had enabled it in User Engagement.

    – Irwin
    Nov 24 '18 at 4:21











  • do you get a 403 all the time? there is a 1 notifications per user per minute limit when sending notifications. do you get any error messages?

    – Reza Nasiri
    Nov 25 '18 at 0:07











  • yep. 100% failures

    – Irwin
    Nov 25 '18 at 1:29











  • Have you enabled the Actions API for your project? Go to the Google Cloud Platform console to activate the Actions API, and select the project that you have created on the Actions on Google console. Then, click the Enable button.

    – Taylor Caldwell
    Nov 26 '18 at 20:41

















Have you enabled Would you like to send push notifications in User Engagement for your intent in your Actions Console ?

– sai.raj
Nov 24 '18 at 3:48





Have you enabled Would you like to send push notifications in User Engagement for your intent in your Actions Console ?

– sai.raj
Nov 24 '18 at 3:48













Yep, I had enabled it in User Engagement.

– Irwin
Nov 24 '18 at 4:21





Yep, I had enabled it in User Engagement.

– Irwin
Nov 24 '18 at 4:21













do you get a 403 all the time? there is a 1 notifications per user per minute limit when sending notifications. do you get any error messages?

– Reza Nasiri
Nov 25 '18 at 0:07





do you get a 403 all the time? there is a 1 notifications per user per minute limit when sending notifications. do you get any error messages?

– Reza Nasiri
Nov 25 '18 at 0:07













yep. 100% failures

– Irwin
Nov 25 '18 at 1:29





yep. 100% failures

– Irwin
Nov 25 '18 at 1:29













Have you enabled the Actions API for your project? Go to the Google Cloud Platform console to activate the Actions API, and select the project that you have created on the Actions on Google console. Then, click the Enable button.

– Taylor Caldwell
Nov 26 '18 at 20:41





Have you enabled the Actions API for your project? Go to the Google Cloud Platform console to activate the Actions API, and select the project that you have created on the Actions on Google console. Then, click the Enable button.

– Taylor Caldwell
Nov 26 '18 at 20:41












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449381%2f403-on-google-action-push-notification-request%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449381%2f403-on-google-action-push-notification-request%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy