{"id":24157,"date":"2024-05-09T07:36:14","date_gmt":"2024-05-09T07:36:14","guid":{"rendered":"https:\/\/www.gmass.co\/blog\/?p=24157"},"modified":"2024-05-09T07:38:59","modified_gmt":"2024-05-09T07:38:59","slug":"oauth-webhook-api","status":"publish","type":"post","link":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/","title":{"rendered":"How to Use the GMass OAuth Webhook API Feature"},"content":{"rendered":"<p>If you need to let a third-party app know when a GMass user has been created \u2014 and enable that app to send emails through that user\u2019s Gmail \/ Google Workspace account using GMass \u2014 yes, you can do that.<\/p>\n<p>The <strong>GMass OAuth webhook API feature<\/strong>\u00a0enables <strong>GMass to pass back key info about a user account to your app<\/strong>.<\/p>\n<p><strong>Example: <\/strong>Let\u2019s say you\u2019re a nonprofit. You\u2019re building a dashboard that uses the GMass API to allow members to send fundraising email campaigns through their own Gmail accounts.<\/p>\n<p>They never sign up for a GMass account, never go to the GMass website, and don\u2019t install the GMass Chrome extension \u2014 all of their campaign composing and management happens on your site through your dashboard.<\/p>\n<p>But\u2026 your app needs to direct people to OAuth in GMass in order for the GMass API to send the campaign through that user\u2019s Gmail account.<\/p>\n<h2>How to Use the GMass Oauth Webhook API Feature<\/h2>\n<p>Your app needs to <strong>direct its users to the GMass OAuth flow<\/strong>\u00a0by sending them to:<\/p>\n<p>https:\/\/gmass.co\/oauth\/login?webhook=https:\/\/whereveryourwebhookislocated.com<\/p>\n<p>That takes the user into the OAuth flow.<\/p>\n<p>On the final GMass screen where the account is created, <strong>GMass makes a webhook call to your URL like this<\/strong>:<\/p>\n<p>https:\/\/whereveryourwebhookislocated.com?apikey=yourusersapikey&#038;emailaddress=youruser@gmail.com<\/p>\n<p>Your app can then capture that information, store the user\u2019s GMass API key, and use it to send emails through the user\u2019s Gmail account.<\/p>\n<h3 id=\"h.jbr8cags1db2\">Optional parameter: What if you want a user to use a specific email address?<\/h3>\n<p>There\u2019s one optional parameter you can send to GMass: An email address. In that case, the login URL would look like this:<\/p>\n<p>https:\/\/gmass.co\/oauth\/login?webhook=https:\/\/whereveryourwebhookislocated.com&#038;emailaddress=youruser@gmail.com<\/p>\n<p>That will <strong>force the Google OAuth process to default to the account you\u2019ve specified<\/strong>.<\/p>\n<p>Without the <strong>emailaddress<\/strong>\u00a0parameter, Google will give the user an option to choose which of their Google accounts to connect.<\/p>\n<p>So this parameter is a useful way to make sure your user stays consistent with the email address they\u2019re using on your platform and when authorizing GMass.<\/p>\n<h3 id=\"h.wfepdz6ge397\">An example in action<\/h3>\n<p>Here\u2019s an example of this in action.<\/p>\n<p>(I\u2019m using <a href=\"https:\/\/webhook.site\">webhook.site<\/a>\u00a0for my example. That\u2019s a website that you can use to test webhooks without, you know, having to build a whole sample app.)<\/p>\n<p>I got a unique webhook URL from webhook.site and pasted this URL into a browser.<\/p>\n<p>https:\/\/gmass.co\/oauth\/login?webhook=https:\/\/webhook.site\/98f3b9e9-d49a-4848-858a&#038;emailaddress=[myemailaddress]<\/p>\n<p>I used the <strong>emailaddress<\/strong>\u00a0parameter to force Google to default to my desired address.<\/p>\n<figure style=\"text-align: center;\"><img decoding=\"async\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/image3-1.png\" alt=\"Thanks to the emailaddress parameter, I do not have to choose an account\" \/><\/figure>\n<p>(If I hadn\u2019t specified an email address, Google would\u2019ve given me an option to choose from every one of their accounts known by that browser.)<\/p>\n<p>I gave GMass authorization by signing in.<\/p>\n<figure style=\"text-align: center;\"><img decoding=\"async\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/image1-1.png\" alt=\"Signing into GMass\" \/><\/figure>\n<p>And all the requisite permissions.<\/p>\n<figure style=\"text-align: center;\"><img decoding=\"async\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/image4-1.png\" alt=\"Giving GMass permissions\" \/><\/figure>\n<p>I reached the success page from GMass. And now going back over to webhook.site, you can see GMass passed my API key and email address back.<\/p>\n<figure style=\"text-align: center;\"><img decoding=\"async\" src=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/image2-1.png\" alt=\"Passing the API key and email address with a webhook call\" \/><\/figure>\n<p>Your app, in this case, would store the API key and email address to use as part of your dashboard.<\/p>\n<h2 id=\"h.cp6m57l30c7y\">More on the GMass API<\/h2>\n<p>Here\u2019s more about the <a href=\"https:\/\/www.gmass.co\/blog\/gmass-api\/\">GMass API<\/a>\u00a0and <a href=\"https:\/\/www.gmass.co\/blog\/webhooks-guide\/\">using webhooks<\/a>\u00a0with GMass.<\/p>\n<p>And <a href=\"https:\/\/www.gmass.co\/support\/form\">let us know<\/a>\u00a0if you\u2019re building a unique application that\u2019s powered by GMass \u2014 we\u2019re always interested in hearing about what you\u2019re doing and we just might be able to help you out.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you need to let a third-party app know when a GMass user has been created \u2014 and enable that app to send emails through that user\u2019s Gmail\u2026<\/p>\n","protected":false},"author":29,"featured_media":24159,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[9152],"tags":[],"class_list":["post-24157","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>How to Use the GMass OAuth Webhook API Feature<\/title>\r\n<meta name=\"description\" content=\"Does your third-party app send email for users through GMass? This method enables you to pass key info from GMass back to your app.\" \/>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"How to Use the GMass OAuth Webhook API Feature\" \/>\r\n<meta property=\"og:description\" content=\"Does your third-party app send email for users through GMass? This method enables you to pass key info from GMass back to your app.\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/\" \/>\r\n<meta property=\"og:site_name\" content=\"GMass Blog\" \/>\r\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GmailMailMerge\/\" \/>\r\n<meta property=\"article:published_time\" content=\"2024-05-09T07:36:14+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2024-05-09T07:38:59+00:00\" \/>\r\n<meta property=\"og:image\" content=\"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/oauthwebook-feat-tinified.png\" \/>\r\n\t<meta property=\"og:image:width\" content=\"2002\" \/>\r\n\t<meta property=\"og:image:height\" content=\"934\" \/>\r\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\r\n<meta name=\"author\" content=\"Sam Greenspan\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@GMassForGmail\" \/>\r\n<meta name=\"twitter:site\" content=\"@GMassForGmail\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sam Greenspan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/\"},\"author\":{\"name\":\"Sam Greenspan\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/de82c1ac2f78713b569bb57bfb313c98\"},\"headline\":\"How to Use the GMass OAuth Webhook API Feature\",\"datePublished\":\"2024-05-09T07:36:14+00:00\",\"dateModified\":\"2024-05-09T07:38:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/\"},\"wordCount\":603,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/oauthwebook-feat-tinified.png\",\"articleSection\":[\"API\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/\",\"name\":\"How to Use the GMass OAuth Webhook API Feature\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/oauthwebook-feat-tinified.png\",\"datePublished\":\"2024-05-09T07:36:14+00:00\",\"dateModified\":\"2024-05-09T07:38:59+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/de82c1ac2f78713b569bb57bfb313c98\"},\"description\":\"Does your third-party app send email for users through GMass? This method enables you to pass key info from GMass back to your app.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/oauthwebook-feat-tinified.png\",\"contentUrl\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/05\\\/oauthwebook-feat-tinified.png\",\"width\":2002,\"height\":934},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/oauth-webhook-api\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use the GMass OAuth Webhook API Feature\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/\",\"name\":\"GMass Blog\",\"description\":\"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/#\\\/schema\\\/person\\\/de82c1ac2f78713b569bb57bfb313c98\",\"name\":\"Sam Greenspan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/544dc4a3d6b96b537586cdde9d818feb8f0de187faed221fdb0dee3a356bf41a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/544dc4a3d6b96b537586cdde9d818feb8f0de187faed221fdb0dee3a356bf41a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/544dc4a3d6b96b537586cdde9d818feb8f0de187faed221fdb0dee3a356bf41a?s=96&d=mm&r=g\",\"caption\":\"Sam Greenspan\"},\"url\":\"https:\\\/\\\/www.gmass.co\\\/blog\\\/author\\\/sam_greenspan\\\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use the GMass OAuth Webhook API Feature","description":"Does your third-party app send email for users through GMass? This method enables you to pass key info from GMass back to your app.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/","og_locale":"en_US","og_type":"article","og_title":"How to Use the GMass OAuth Webhook API Feature","og_description":"Does your third-party app send email for users through GMass? This method enables you to pass key info from GMass back to your app.","og_url":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/","og_site_name":"GMass Blog","article_publisher":"https:\/\/www.facebook.com\/GmailMailMerge\/","article_published_time":"2024-05-09T07:36:14+00:00","article_modified_time":"2024-05-09T07:38:59+00:00","og_image":[{"width":2002,"height":934,"url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/oauthwebook-feat-tinified.png","type":"image\/png"}],"author":"Sam Greenspan","twitter_card":"summary_large_image","twitter_creator":"@GMassForGmail","twitter_site":"@GMassForGmail","twitter_misc":{"Written by":"Sam Greenspan","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#article","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/"},"author":{"name":"Sam Greenspan","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/de82c1ac2f78713b569bb57bfb313c98"},"headline":"How to Use the GMass OAuth Webhook API Feature","datePublished":"2024-05-09T07:36:14+00:00","dateModified":"2024-05-09T07:38:59+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/"},"wordCount":603,"commentCount":0,"image":{"@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/oauthwebook-feat-tinified.png","articleSection":["API"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/","url":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/","name":"How to Use the GMass OAuth Webhook API Feature","isPartOf":{"@id":"https:\/\/www.gmass.co\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#primaryimage"},"image":{"@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#primaryimage"},"thumbnailUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/oauthwebook-feat-tinified.png","datePublished":"2024-05-09T07:36:14+00:00","dateModified":"2024-05-09T07:38:59+00:00","author":{"@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/de82c1ac2f78713b569bb57bfb313c98"},"description":"Does your third-party app send email for users through GMass? This method enables you to pass key info from GMass back to your app.","breadcrumb":{"@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#primaryimage","url":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/oauthwebook-feat-tinified.png","contentUrl":"https:\/\/www.gmass.co\/blog\/wp-content\/uploads\/2024\/05\/oauthwebook-feat-tinified.png","width":2002,"height":934},{"@type":"BreadcrumbList","@id":"https:\/\/www.gmass.co\/blog\/oauth-webhook-api\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gmass.co\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Use the GMass OAuth Webhook API Feature"}]},{"@type":"WebSite","@id":"https:\/\/www.gmass.co\/blog\/#website","url":"https:\/\/www.gmass.co\/blog\/","name":"GMass Blog","description":"Tips and tricks for sending mail merge and mass email campaigns directly from Gmail","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gmass.co\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.gmass.co\/blog\/#\/schema\/person\/de82c1ac2f78713b569bb57bfb313c98","name":"Sam Greenspan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/544dc4a3d6b96b537586cdde9d818feb8f0de187faed221fdb0dee3a356bf41a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/544dc4a3d6b96b537586cdde9d818feb8f0de187faed221fdb0dee3a356bf41a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/544dc4a3d6b96b537586cdde9d818feb8f0de187faed221fdb0dee3a356bf41a?s=96&d=mm&r=g","caption":"Sam Greenspan"},"url":"https:\/\/www.gmass.co\/blog\/author\/sam_greenspan\/"}]}},"_links":{"self":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/24157","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/comments?post=24157"}],"version-history":[{"count":2,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/24157\/revisions"}],"predecessor-version":[{"id":24160,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/posts\/24157\/revisions\/24160"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/media\/24159"}],"wp:attachment":[{"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/media?parent=24157"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/categories?post=24157"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gmass.co\/blog\/wp-json\/wp\/v2\/tags?post=24157"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}