opensource icon indicating copy to clipboard operation
opensource copied to clipboard

PowerShell module

Open vmsilvamolina opened this issue 6 years ago • 12 comments

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

vmsilvamolina avatar Oct 02 '18 21:10 vmsilvamolina

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": "[email protected]"}]}],"from": {"email": "[email protected]"},"subject": "Sending with SendGrid is Fun","content": [{"type": "text/plain", "value": "and easy to do anywhere, even with PowerShell"}]}'

movinalot avatar Oct 03 '18 03:10 movinalot

@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.

vmsilvamolina avatar Oct 03 '18 10:10 vmsilvamolina

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?

thinkingserious avatar Oct 05 '18 01:10 thinkingserious

@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?

vmsilvamolina avatar Oct 05 '18 08:10 vmsilvamolina

@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 avatar Oct 05 '18 13:10 aroach

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

aroach avatar Oct 17 '18 03:10 aroach

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

vmsilvamolina avatar Oct 18 '18 09:10 vmsilvamolina

@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?

vmsilvamolina avatar Nov 05 '18 16:11 vmsilvamolina

@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 avatar Nov 05 '18 22:11 aroach

@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.

aroach avatar Nov 05 '18 22:11 aroach

Hi,

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

maor29 avatar Oct 02 '19 19:10 maor29

@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

aroach avatar Oct 16 '19 15:10 aroach