sendgrid / opensource

SendGrid Open Source Dashboard
http://github.com/sendgrid
MIT License
35 stars 13 forks source link

PowerShell module #2

Open vmsilvamolina opened 6 years ago

vmsilvamolina commented 6 years ago

I think that it would a good idea develop a module for PowerShell

movinalot commented 6 years ago

Until then...

Invoke-RestMethod -Uri https://api.sendgrid.com/v3/mail/send -Method Post -Headers @{"Authorization" = "Bearer $SENDGRID_API_KEY"; "Content-Type" = "application/json"} -Body '{"personalizations": [{"to": [{"email": "test@example.com"}]}],"from": {"email": "test@example.com"},"subject": "Sending with SendGrid is Fun","content": [{"type": "text/plain", "value": "and easy to do anywhere, even with PowerShell"}]}'

vmsilvamolina commented 6 years ago

@movinalot Yes, I know that method, but my idea is create something more elaborate: If you have a module, you can install it, and use cmdlet with a friendly-name-functions linke "Get-SendGridConfiguration". Obviusly, for build the module you can use that API.

thinkingserious commented 6 years ago

Great idea @vmsilvamolina! Would that be something that would be deployed to Nuget?

@movinalot would you mind making a PR against our docs with your example?

vmsilvamolina commented 6 years ago

@thinkingserious I think it fits better on the PowerShell library https://www.powershellgallery.com/. You can install the module using the cmdlet Install-Module <moduleName>.

About the examples... can I help with the PR over the docs?

aroach commented 6 years ago

@vmsilvamolina it'd be great if you want to help! If you'd like to make that PR for the documentation, that's totally fine. I don't think @movinalot will mind if you do that. Also, do you want to try to make that PowerShell module too? I'm not that familiar with the process there.

aroach commented 6 years ago

@vmsilvamolina @movinalot have a look at this. I implemented a very basic version here https://github.com/aroach/sendgrid-powershell

vmsilvamolina commented 6 years ago

@aroach perfect! Can you add that to the SendGrid repo? Thats is a good point of start

vmsilvamolina commented 5 years ago

@aroach how can I continue with this?, You have a module with a function, what is the next step? Does I work on your repo or I make a new pull request for the SendGrid organization?

aroach commented 5 years ago

@vmsilvamolina since it's a new language, I think it warrants a new repo in our Org, yeah? @thinkingserious does that seem OK to you?

aroach commented 5 years ago

@vmsilvamolina in the meantime, you're welcome to fork it and move it forward. We can transfer it to the SendGrid org when the time is right.

maor29 commented 5 years ago

Hi,

I need to create a powershell script to create the API Keys in SendGrid. Does anyone know how to do that?

aroach commented 5 years ago

@maor29 have a look at this project. You should just need to tweak this file to agree with the API Keys API

https://github.com/aroach/sendgrid-powershell/blob/4918a8cce905a8489ada25a6efb3da4dd51af216/sendgrid.powershell.psm1#L71