Skip to content

Commit 8c0f00e

Browse files
committed
update readme
1 parent 7009389 commit 8c0f00e

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,57 @@ convoy = Convoy({ "api_key": 'your_api_key', "uri": 'self-hosted-instance' })
3232

3333
## Usage
3434

35+
### Get all groups
36+
37+
```python
38+
(response, status) = convoy.group.all({ "perPage": 10, "page": 1 })
39+
```
40+
41+
### Creating an Application
42+
43+
An application represents a user's application trying to receive webhooks. Once you create an application, you'll receive a `uid` that you should save and supply in subsequent API calls to perform other requests such as creating an event.
44+
45+
```python
46+
appData = { "name": "my_app", "support_email": "[email protected]" }
47+
(response, status) = convoy.applications.create({}, appData)
48+
appId = response["data"]["uid"]
49+
50+
```
51+
52+
### Add Application Endpoint
53+
54+
After creating an application, you'll need to add an endpoint to the application you just created. An endpoint represents a target URL to receive events.
55+
56+
```python
57+
endpointData = {
58+
"url": "https://0d87-102-89-2-172.ngrok.io",
59+
"description": "Default Endpoint",
60+
"secret": "endpoint-secret",
61+
"events": ["*"],
62+
}
63+
64+
(response, status) = convoy.endpoint.create(appId, {}, endpointData)
65+
```
66+
67+
### Sending an Event
68+
69+
To send an event, you'll need the `uid` we created in the earlier section.
70+
3571
```python
36-
content, status = convoy.group.all({ "perPage": 10, "page": 1 })
72+
eventData = {
73+
"app_id": appId,
74+
"event_type": "payment.success",
75+
"data": {
76+
"event": "payment.success",
77+
"data": {
78+
"status": "Completed",
79+
"description": "Transaction Successful",
80+
"userID": "test_user_id808",
81+
},
82+
},
83+
}
84+
85+
(response, status) = convoy.event.create({}, eventData)
3786
```
3887

3988
## Testing

0 commit comments

Comments
 (0)