inbound

command
v3.3.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2016 License: MIT Imports: 12 Imported by: 0

README

This helper is a stand alone module to help get you started consuming and processing Inbound Parse data.

Table of Contents

Quick Start for Local Testing with Sample Data

git clone https://github.com/sendgrid/sendgrid-go.git
cd sendgrid-go

Run the Inbound Parse listener in your terminal:

cd helpers/inbound/
go run inbound.go

In another terminal, run the test data sender:

cd [path to sendgrid-go/helpers/inbound]
go run inbound.go ./sample_data/default_data.txt http://127.0.0.1:8000/inbound

More sample data can be found here.

View the results in the first terminal.

Quick Start for Local Testing with Real Data

Setup your MX records. Depending on your domain name host, you may need to wait up to 48 hours for the settings to propagate.

Run the Inbound Parse listener in your terminal:

git clone https://github.com/sendgrid/sendgrid-go.git
go run inbound.go

In another terminal, use ngrok to allow external access to your machine:

ngrok http 8000

Update your SendGrid Incoming Parse settings: Settings Page | Docs

  • For the HOSTNAME field, use the domain that you changed the MX records (e.g. inbound.yourdomain.com)
  • For the URL field, use the URL generated by ngrok + /inbound, e.g http://XXXXXXX.ngrok.io/inbound

Next, send an email to [anything]@inbound.yourdomain.com, then look at the terminal where you started the Inbound Parse listener.

Deploy to Heroku

If you would like to help implement this, please see this ticket.

Code Walkthrough

inbound.go

This module runs a net/http server, that by default (you can change those settings here, listens for POSTs on http://localhost:8000. When the server receives the POST, it parses and prints the key/value data.

conf.json

This file contains application environment variables (located in config.json).

inbound.go & /sample_data

This module, in conjuction with the sample data, is also used to send sample test data. It is useful for testing and development, particularly while you wait for your MX records to propogate.

Testing the Source Code

Tests are located in the helpers/inbound folder:

Learn about testing this code here.

Contributing

If you would like to contribute to this project, please see our contributing guide. Thanks!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL