← Back to Blog

Respond in bulk using the logic app and gmail filter

Respond in bulk using the logic app and gmail filter starts with oauth journey!

Respond in bulk using the logic app and gmail filter

starts with oauth journey! and moves on to sandbox with jsons

using the filter go over them

respond in bulk 1

todo > check the leads do not send 2 emails in one week >>>

todo > send the optimized version always

todo > add the contact date

Gmail label is the key to the solution

respond in bulk 2

Issue is the locale >>> Send them a bulk email might not make sense ?

todo: spot the locale of the email >>> send the attachments >>> make sure you are in their email database

there is no listing with the labels

respond in bulk 3

respond in bulk 4

respond in bulk 5

https://gmail.googleapis.com/gmail/v1/users/[email protected]/messages?q=label:0_sales_triggerlogicappwithmessageLabel

respond in bulk 6

Go to gmail api

respond in bulk 7

Enable first

respond in bulk 8

https://console.cloud.google.com/apis/library/gmail.googleapis.com?project=pexabo-252021

Generate a key

respond in bulk 9

key=apikey did not work

respond in bulk 10

bearer keyword

https://stackoverflow.com/questions/35433362/how-to-post-access-token-parameter-to-the-gmail-api

IT SAID UNSANITIZED

respond in bulk 11

respond in bulk 12

move to oauth

respond in bulk 13

postman giving a good idea

respond in bulk 14

https://www.postman.com/api-evangelist/workspace/google/request/35240-0f7aae6f-445f-4063-bc17-2c75b9dae4d3

respond in bulk 15

Forked version and testing

respond in bulk 16

create the sysntax

respond in bulk 17

same error at least the other parts should be ok

respond in bulk 18

Path variable did not change it

respond in bulk 19

focus on oauth2

respond in bulk 20

there is download json at the creation stage

respond in bulk 21

format dsl needed

respond in bulk 22

edit and add the oauth2 token

respond in bulk 23

a bit more complex usecase

respond in bulk 24

https://learn.microsoft.com/en-us/answers/questions/1178938/how-to-use-oauth-2-0-authorization-in-logic-apps-h

I need 2?

respond in bulk 25

Instead of status code something else is needed

respond in bulk 26

2 step action why computer people get paid

respond in bulk 27

respond in bulk 28

multi video https://youtu.be/IV3PN7IejTg

Workflow

respond in bulk 29

Multi stage in the middle apps

respond in bulk 30

oauth2 >>> 2 stages for the tokens >> temporary access

First one to pass to the other one >>> get the json and it has the necesarry call mechanism

respond in bulk 31

Add all to make it work

respond in bulk 32

Granttype error

respond in bulk 33

Main document

https://developers.google.com/identity/protocols/oauth2

Getting the code

respond in bulk 34

Postman has the client to get this working

respond in bulk 35

https://blog.postman.com/how-to-access-google-apis-using-oauth-in-postman/

similar implementation

respond in bulk 36

url is token not auth like mine

respond in bulk 37

error is back

respond in bulk 38

similar issue

https://stackoverflow.com/questions/59210775/able-to-generate-token-for-salesforce-using-postman-but-same-i-tried-using-logic

in the body similar error

respond in bulk 39

json should have this parameter!

Another app similar use > https://www.mikaelsand.se/2023/01/getting-a-bearer-token-from-aad-using-logic-apps/

access token with multi stages

https://gotoguy.blog/2020/12/05/blog-series-powering-up-your-home-office-lights-part-4-using-logic-apps-to-get-access-token-and-renew-access-token-if-needed/

someone sorted with a different action?

https://stackoverflow.com/questions/76535668/how-do-i-use-an-azure-logic-app-to-request-an-oauth-access-token

i get this error

respond in bulk 40

i move to application/json it did not change

https://stackoverflow.com/questions/76535668/how-do-i-use-an-azure-logic-app-to-request-an-oauth-access-token

no built in connector

respond in bulk 41

Pivot and use a function

respond in bulk 42

Goal > save 40 minute of email reply time daily

respond in bulk 43

move to function app and use python!

https://cloud.google.com/functions/docs/samples/functions-bearer-token#functions_bearer_token-python

respond in bulk 44

https://cloud.google.com/functions/docs/samples/functions-bearer-token#functions_bearer_token-python

simpler play by using the google code that is ready

respond in bulk 45

python no browser based generators

respond in bulk 46

make platform ready action

respond in bulk 47

https://stackoverflow.com/questions/38494279/how-do-i-get-an-oauth-2-0-authentication-token-in-c-sharp

Create a function was there

respond in bulk 48

its own libraries can not be loaded

respond in bulk 49

add new library

respond in bulk 50

dot net library

https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth

library testin

respond in bulk 51

Google to be loaded?

respond in bulk 52

Docker ?

your code your library more cosrt

respond in bulk 53

There is a cost based on it so there is a decision to be made here

using the http is much better >>> find the way

https://stackoverflow.com/questions/43408821/google-oauth2-returns-unsupported-grant-type-via-curl-php

Gmail api and first principles

respond in bulk 54

verification not required

respond in bulk 55

There is javascript there

respond in bulk 56

maybe the javascript version can work on the logic app

respond in bulk 57

respond in bulk 58

https://developers.google.com/identity/protocols/oauth2/javascript-implicit-flow

old frined javascript

respond in bulk 59

Thanks for the complex diagram

respond in bulk 60

restart here

respond in bulk 61

Centralised and bespoke system

respond in bulk 62

Back to the IDE on the mac

respond in bulk 63

Concepts

respond in bulk 64

There is a specification

respond in bulk 65

Game server not to get the username and password

respond in bulk 66

Python implementation

respond in bulk 67

OAuth implementation

https://github.com/LindaLawton/GoogleAuthSimple/blob/master/GoogleAuthWinForm/AuthResponse.cs

Maybe oauth by postman is a better example

As I do not wanna pay for the process runner

first step just starts with the clientid

respond in bulk 68

maybe logic app with token would not resolve the issue >>> as it always need a page?

I might need an app code

respond in bulk 69

Response has the code

respond in bulk 70

Second one had the clientid secret and code >>> to get refresh code

respond in bulk 71

Last one is the access code

Refresh and access token comes in

respond in bulk 72

respond in bulk 73

Collection

https://github.com/afsarali273/GmailAPI/blob/master/Gmail/Gmail%20Authentication.postman_collection.json

Refresh token lets you get an access token all the time

respond in bulk 74

80 percent of the job is the access token part

respond in bulk 75

ecen the message id is here

respond in bulk 76

Start with terminate and pretty jason > Code could be the critical part

respond in bulk 77

url different

respond in bulk 78

it send me a page to open

respond in bulk 79

The output is atleast making some sense?

respond in bulk 80

respond in bulk 81

different errors can be progress

respond in bulk 82

removed user intervention to click is what i am looking for

respond in bulk 83

https://stackoverflow.com/questions/25816335/using-google-apis-for-ones-own-account-without-oauth

There is a playground

respond in bulk 84

Exhange code for tokens is there

respond in bulk 85

Setting shown on ui

respond in bulk 86

https://developers.google.com/oauthplayground/

use your own

respond in bulk 87

fix for redirect

respond in bulk 88

respond in bulk 89

https://developers.google.com/oauthplayground

add the second one

respond in bulk 90

uploader name is there

respond in bulk 91

but i had to click it

respond in bulk 92

at least the labels are back

respond in bulk 93

I might need the service account there is still no way without the redirect page?

There is force prompt no option

respond in bulk 94

List url

https://gmail.googleapis.com/gmail/v1/users/[email protected]/messages

respond in bulk 95

Roll back to step 1

respond in bulk 96

Request / Response

HTTP/1.1 302 Found
Location: https://accounts.google.com/o/oauth2/v2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly&redirect_uri=https%3A%2F%2Fdevelopers.google.com%2Foauthplayground&response_type=code&client_id=525153367542-11jl9ofu41q7249kj7edcp7vdmigu2jb.apps.googleusercontent.com&access_type=offline

GET /oauthplayground/?code=4%2F0AfJohXmieP3pOwUbweSi99iMjz2J5zZxrRG9g8ta9VHOtIvlShgQGdIl5tsG3PkEeZpEew&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly HTTP/1.1
Host: developers.google.com

Am i getting one time code for unattended access?

https://developers.google.com/identity/protocols/oauth2/web-server#offline

my use case with logic apps unattended server

https://developers.google.com/identity/protocols/oauth2/web-server#offline

Inside still this is missing

https://accounts.google.com/signin/oauth/error/v2?authError=Cg9pbnZhbGlkX3JlcXVlc3QSLFJlcXVpcmVkIHBhcmFtZXRlciBpcyBtaXNzaW5nOiByZXNwb25zZV90eXBlGjdodHRwczovL2RldmVsb3BlcnMuZ29vZ2xlLmNvbS9pZGVudGl0eS9wcm90b2NvbHMvb2F1dGgyIJAD

respond in bulk 97

maybe the way to go is to get the emails from outlook

respond in bulk 98

todo > than from email address needs to be parsed some how!

I can forward than i lose some metadata

respond in bulk 99

Also forward did not work as well

respond in bulk 100

getting this code in the server is the key but i dont have the server in the serverless logic app format

respond in bulk 101

>>> maybe i read the emails and put them to a database than i process them from the database ?

Do it on a temporary basis than move on to a trigger basis

respond in bulk 102

https://developers.google.com/oauthplayground/?code=4%2F0AfJohXmieP3pOwUbweSi99iMjz2J5zZxrRG9g8ta9VHOtIvlShgQGdIl5tsG3PkEeZpEew&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly

Allow it( maybe in the future i resolve this issue)

respond in bulk 103

Temporary labels output

Request / Response

GET /gmail/v1/users/[email protected]/labels HTTP/1.1
Host: gmail.googleapis.com
Content-length: 0
Authorization: Bearer ya29.a0AfB_byD6rfdL-g7yT7tB64YeJUEPwS8RyfVTdVe7_-UwIMdXDW83jMKuiLu6vQKv8Xxb0QzM24-2-ynTNToIF9FiOvYUvPS2PqBKS-WBkSC2iCKjKUa4C3c715sy9CtwhXqWnZTWetCYF4MZKYOuf2ZdoU-BwbkzsifpaCgYKARcSAQ8SFQHGX2Mi1w_tR3-OxLw6XkFpEAwxpA0171HTTP/1.1 200 OK
Content-length: 4085
X-xss-protection: 0
Content-location: https://gmail.googleapis.com/gmail/v1/users/[email protected]/labels
X-content-type-options: nosniff
Transfer-encoding: chunked
Vary: Origin, X-Origin, Referer
Server: ESF
-content-encoding: gzip
Cache-control: private
Date: Thu, 25 Jan 2024 18:46:07 GMT
X-frame-options: SAMEORIGIN
Alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
Content-type: application/json; charset=UTF-8{
  "labels": [
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "CHAT",
      "name": "CHAT"
    },
    {
      "type": "system",
      "id": "SENT",
      "name": "SENT"
    },
    {
      "type": "system",
      "id": "INBOX",
      "name": "INBOX"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "IMPORTANT",
      "name": "IMPORTANT"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "TRASH",
      "name": "TRASH"
    },
    {
      "type": "system",
      "id": "DRAFT",
      "name": "DRAFT"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "SPAM",
      "name": "SPAM"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "CATEGORY_FORUMS",
      "name": "CATEGORY_FORUMS"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "CATEGORY_UPDATES",
      "name": "CATEGORY_UPDATES"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "CATEGORY_PERSONAL",
      "name": "CATEGORY_PERSONAL"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "CATEGORY_PROMOTIONS",
      "name": "CATEGORY_PROMOTIONS"
    },
    {
      "type": "system",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "CATEGORY_SOCIAL",
      "name": "CATEGORY_SOCIAL"
    },
    {
      "type": "system",
      "id": "STARRED",
      "name": "STARRED"
    },
    {
      "type": "system",
      "id": "UNREAD",
      "name": "UNREAD"
    },
  **  {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_1452878502214202942",
      "name": "0_sales_triggerlogicappwithmessageLabel"
    }, **
    {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_2108590433463520064",
      "name": "0_sales_USACorp"
    },
    {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_3411671104323131884",
      "name": "2_spending_invoice"
    },
    {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_4235701552592087655",
      "name": "3_packing_thinkific"
    },
    {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_4243453649684566832",
      "name": "3_pack_udemy"
    },
    {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_4716836601042464671",
      "name": "1_borrow_followupMain"
    },
    {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_4808420618647086460",
      "name": "0_sales_pluralsight"
    },
    {
      "type": "user",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "show",
      "id": "Label_5572518215070687438",
      "name": "spending_visafollowup"
    },
    {
      "type": "user",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "Label_5837701917314130044",
      "name": "_sales_Payoneer"
    },
    {
      "type": "user",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "Label_6",
      "name": "Notes"
    },
    {
      "type": "user",
      "labelListVisibility": "labelHide",
      "messageListVisibility": "hide",
      "id": "Label_7904937592462891222",
      "name": "_sales_cprime"
    }
  ]
}

my selection

**  {
      "type": "user",
      "labelListVisibility": "labelShow",
      "messageListVisibility": "show",
      "id": "Label_1452878502214202942",
      "name": "0_sales_triggerlogicappwithmessageLabel"
    }, **

57 messages to pull

respond in bulk 104

Google Api explorer is the action

respond in bulk 105

Api explorer is the way to go

respond in bulk 106

Much practical

respond in bulk 107

57 to 58 >>> tested as the labels are working

respond in bulk 108

Never worked now it is going to work >>> i also expect the leads to be added

respond in bulk 109

test with one

respond in bulk 110

Lets make replyid work first

respond in bulk 111

multi fails

respond in bulk 112

retry none

respond in bulk 113

Location not send

respond in bulk 114

email not send

respond in bulk 115

gmail works not the best still it is in

respond in bulk 116

Every 30 seconds to send it

respond in bulk 117

check before cancel > many events at home happening

respond in bulk 118

multi sending issue

respond in bulk 119

Recruiter already in

respond in bulk 120

it looks like i am sending an email but not saving to the database

respond in bulk 121

answered a request>>> i am working / yelled >>> working from home others are not there >>> not noticing the gaps and moving on to other things that happens at home

contractormarketing-savelead-bygmaillabel >>> future logic app todo it.


Imported from rifaterdemsahin.com · 2024