How do I setup HTTP Post notifications?

Last updated by Adam West on September 20, 2017 14:01

If you have a 3rd party application, such as your own custom CRM, you may wish to receive notifications there. Deploy can generate notifications by way of HTTP Post, so you can set up an endpoint to display the notifications in your application.

  1. Firstly navigate to the Notifications via the Settings drop down from within the project you wish to add notifications to:
  2. Click on the + button on the right hand side within the Notifications pane:
  3. Select HTTP Post from the Notification Type drop down:
  4. Enter the URL of your endpoint, and a username and API key or password (depending on the authentication method you have set up on your endpoint):
  5. Click Save to save the notification.
                                                                                      

Deploy supports sending notifications in JSON format when a deployment is made. With JSON, the payload will be delivered to the specified HTTP/HTTPS URL along with a signature from Deploy so you can verify where the message originated from.

Our public key

-----BEGIN PUBLIC KEY----- 
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDXJcP2N6NtcN26Q8nVaidXOA0w 
RxWK2HQTblIaQdGRDjqTvhrSlFuV5N4jz7w/w8uskP20G7ZQ+CkHwIXrWk76KZJn 
pdoOHPO6AqRmEFgV5Q6Y1CR77mvnT9O21hTnfzfyyiAdQC2oO8M9/jeLRPTAqmkG 
xdQa8iepUz4BwrrHmwIDAQAB 
-----END PUBLIC KEY-----

Example payload

{    
	"files": {         
	    "changed": ["changedfile"],         
	    "removed": [ 
	      ".gitmodules",             
              "extensions",             
	      "extensions/markdown"         
	    ]     
	},     
	"project": {         
	    "permalink": "test-repo-2",         
	    "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCuB80S+kMN1266LvCEXoU5hmjugcuXko61Hl7uD9VVgMgEOrLSkeYktOPshgCOwjQgGhSMVEHWrSuOddOi+V3rOu3v    91jiU3vycRM3nK9GMaOFf+tTn0/4ReUvGOFHeir1vluHCmOAmpqsVhGWkCJY6eJE37muvGxdfdgMVx5LU+zYLntvB5PXd7h1k5ROO8lW+5QzGVyHHEvilzJOqESIAW    pNtcXGBt7clWpFH4lg2AT7JebYFuHl8Sl4LYzIRegcpg718CWJjrck9/xV6CBTGP520ifU6K0x4JOn/qFzVlqwnxmrPXwawptmCiYiJt3X8Oz",         
	    "name": "Test Project",         
	    "repository": {             
	        "port": null,             
	        "username": null,             
	        "branch": "master",             
	        "url": "git@codebasehq.com:test/deploytest/test1.git",             
	        "scm_type": "git",             
	        "cached": true,             
	        "hosting_service": {                 
	            "name": "Codebase",                 
	            "url": "http://www.codebasehq.com",            
                    "commits_url":"http://test.codebasehq.com/projects/deploytest/repositories/test1/commits/master",             	"tree_url":"http://test.codebasehq.com/projects/deploytest/repositories/test1/tree/master"					                       
	        }         
	    }     
	},     
	"server": {         
	    "name": "cybele",         
            "server_path": "/home/dan/deploytest",         
	    "port": 22,         
	    "username": "dan",         
            "use_ssh_keys": true,         
            "last_revision": "2ad223b9dd6d006d69909407ac7df322e35b009b",         
	    "hostname": "cybele.example.com",         
            "identifier": "de99437e-da4a-0986-a7ab-e55805261a96",         
	    "protocol_type": "ssh"     
        },     
        "start_revision": {         
	    "timestamp": "2011-11-30T13:48:22+00:00",         
	    "author": "Dan Wentworth",         
            "ref": "a1c1073b85d1662c075d77f5d88be3fd291abd12",         
	    "message": "nested markdown",         
	    "email": "dan@example.com"     
	},     
	"identifier": "9d0f9c21-f242-3966-fcd3-e821a65acd45",     
	"end_revision": {         
	    "timestamp": "2011-08-30T16:41:32+01:00",         
	    "author": "Dan Wentworth",         
	    "ref": "2ad223b9dd6d006d69909407ac7df322e35b009b",         
	    "message": "updated renderer",         
	    "email": "dan@example.com"     
	},     
	"configuration": {         
	    "email_notify": true,         
	    "notification_addresses": "dan@example.com",         
	    "copy_config_files": true     
	},     
	"timestamps": {         
	    "completed_at": "2012-01-17T09:22:15Z",         
            "duration": null,         
	    "queued_at": "2012-01-17T09:22:07Z",         
	    "started_at": "2012-01-17T09:22:10Z"     
	},     
	"status": "completed" 
}

You can also receive an e-mail with deployment details, but this is done by simply selecting the option after clicking on 'Show advanced options?' when making a Deployment.