---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/go-code-example#article
headline: Event Webhook Go Code Example
description: Optimize SendGrid's Inbound Parse Webhook integration using the Go SDK. Make emails work for you by parsing and posting seamlessly.
url: https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/go-code-example
inLanguage: en
dateModified: 2026-07-23T16:57:51.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# Event Webhook Go Code Example

## Parse Webhook

This example shows how to parse inbound emails with Go and the Twilio SendGrid Inbound Parse Webhook.

> \[!NOTE]
>
> We recommend using our official Go SDK, our client library with full documentation, when integrating with [SendGrid's Inbound Parse Webhook](https://github.com/sendgrid/sendgrid-go/tree/master/helpers/inbound).

In this example, we want to parse all emails at `address@email.sendgrid.biz` and post the parsed email to `http://sendgrid.biz/upload`

Given this scenario, the following are the parameters you would set at the [Parse API settings page](https://sendgrid.com/developer/reply):

```bash
Hostname: email.sendgrid.biz
```

```bash
URL: http://sendgrid.biz/upload
```

To test this scenario, we sent an email to `example@example.com` and created the following code:

```go

package main

import (
        "fmt"
        "net/http"
        "io/ioutil"
        "log"
        "github.com/sendgrid/sendgrid-go"

)

func Parse (w http.ResponseWriter, req *http.Request) {
        //Get Email Values
        to := req.FormValue("from")
        subject := req.FormValue("subject")
        body:= req.FormValue("text")

        //Get Uploaded File
        file, handler, err := req.FormFile("attachment1")
        if err != nil {
                fmt.Println(err)
        }
        data, err := ioutil.ReadAll(file)
        if err != nil {
                fmt.Println(err)
        }
        err = ioutil.WriteFile(handler.Filename, data, 0777)
        if err != nil {
                fmt.Println(err)
        }
}

func main() {
        http.HandleFunc("/upload", Parse)
        err := http.ListenAndServe(":3000", nil)
        if err != nil {
                log.Fatal("ListenAndServe: ", err)
        }
}

```
