Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set event webhooks for subusers #290

Open
h0jeZvgoxFepBQ2C opened this issue Apr 24, 2018 · 2 comments
Open

Set event webhooks for subusers #290

h0jeZvgoxFepBQ2C opened this issue Apr 24, 2018 · 2 comments
Labels
difficulty: easy fix is easy in difficulty status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap

Comments

@h0jeZvgoxFepBQ2C
Copy link

Issue Summary

Right now we are migrating from Mailgun to Sendgrid, due to their generally bad IP reputation on Outlook 365 and other mail service providers. We nearly finished the migration, but right now we are experiencing a showstopper for us:

We have a subdomain for each ouf our customers (customer1.mycompany.com., customernext123.mycompany.com,... and so on) and we also want everything seperated: reverse dns, link tracking domains, sender domains, subusers for each customer - so we want to add all these things to our subusers.

The only problem stops us now is, that you can't add webhooks for subusers?
There is nothing mentioned in the documentation unfortunately, but at least your support told me that I can submit such a request by setting a on-behalf-of header:

In order to make API calls for the subuser through the parent account, you can use the On-Behalf-Of header.

In the header you are passing you will need to add:
On-Behalf-Of: subuser_username

This will make the API call as if it was the subuser account making the call. Just make sure you are using the correct subuser username.

Also, when authenticating using this header, you will need to use the parent account's username and password or an API key that has Subuser Management permissions. When authenticating using basic auth it will require a base64 encoded username/password.

Examples:


Using in cURL call:

curl --request POST \ 
--url api.sendgrid.com/v3/api_keys \ 
--header 'authorization: Bearer SENDGRID_API_KEY’ \ 
--header 'content-type: application/json' \ 
--header 'On-Behalf-Of: subuser_username’\ 
--data '{"name":"My API Key","scopes":["mail.send","alerts.create","alerts.read"]}' 


Using in Sendgrid Ruby SDK:

sg = SendGrid::API.new(
    api_key: ENV['SENDGRID_API_KEY'],
    host: 'api.sendgrid.com',
    request_headers["On-Behalf-Of"] => subuser_usrname_var)

But somehow this looks like a hack and it would be much better to implement this natively in the ruby gem, by just adding the username paramter to the PATCH /user/webhooks/event/settingscall (https://github.com/sendgrid/sendgrid-ruby/blob/master/USAGE.md#update-event-notification-settings)

What do you think? Is there any chance of getting this implemented in the near future? Thank you!

Technical details:

  • sendgrid-ruby Version: master (latest commit: [commit number])
  • Ruby Version: 2.2
@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: help wanted requesting help from the community difficulty: easy fix is easy in difficulty up-for-grabs labels Apr 24, 2018
@thinkingserious
Copy link
Contributor

Hi @lichtamberg,

Welcome to SendGrid, we are glad to have you!

To get this implemented in the near future, the following would help:

  1. A PR
  2. More votes on this issue

In the mean time, I've added this to our backlog. Thanks for bringing this issue to light!

With Best Regards,

Elmer

@fthobe
Copy link

fthobe commented Feb 24, 2021

@thinkingserious Hi Elmer, any chance to see this happening? Fabian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy fix is easy in difficulty status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

4 participants