mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Document humbug-send and humbugrc in README for API users
(imported from commit 9ca282d4d768f2d2a474da1209621f03147954fe)
This commit is contained in:
		
							
								
								
									
										19
									
								
								api/README
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								api/README
									
									
									
									
									
								
							@@ -15,9 +15,14 @@ as we make any changes to them.
 | 
				
			|||||||
The easiest way to use these API bindings is to base your tools off
 | 
					The easiest way to use these API bindings is to base your tools off
 | 
				
			||||||
of the example tools under api/examples in this distribution.
 | 
					of the example tools under api/examples in this distribution.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If you place your API key in ~/.humbug-api-key the Python API
 | 
					If you place your API key in `~/.humbugrc` the Python API bindings will
 | 
				
			||||||
bindings will automatically read it in.  You can obtain your Humbug
 | 
					automatically read it in. The format of the config file is as follows:
 | 
				
			||||||
API key from the Humbug settings page.
 | 
					
 | 
				
			||||||
 | 
					    [api]
 | 
				
			||||||
 | 
					    key=<api key from the web interface>
 | 
				
			||||||
 | 
					    email=<your email address>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can obtain your Humbug API key from the Humbug settings page.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A typical simple bot sending API messages will look as follows:
 | 
					A typical simple bot sending API messages will look as follows:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -48,3 +53,11 @@ send_message() returns a dict guaranteed to contain the following
 | 
				
			|||||||
keys: msg, result.  For successful calls, result will be "success" and
 | 
					keys: msg, result.  For successful calls, result will be "success" and
 | 
				
			||||||
msg will be the empty string.  On error, result will be "error" and
 | 
					msg will be the empty string.  On error, result will be "error" and
 | 
				
			||||||
msg will describe what went wrong.
 | 
					msg will describe what went wrong.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### Sending messages
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You can use the included `api/bin/humbug-send` script to send messages via the
 | 
				
			||||||
 | 
					API directly from existing scripts.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    humbug-send hamlet@example.com cordelia@example.com -m \
 | 
				
			||||||
 | 
					        "Conscience doth make cowards of us all."
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								api/examples/humbugrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								api/examples/humbugrc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
				
			|||||||
 | 
					; put this file in ~/.humbugrc
 | 
				
			||||||
 | 
					[api]
 | 
				
			||||||
 | 
					key=<api key from the web interface>
 | 
				
			||||||
 | 
					email=<your email address>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user