Back to Collection Items
void ChilkatSample(void)
{
http.put_BasicAuth(true); http.put_Login(L"username"); http.put_Password(L"password"); json.UpdateString(L"matchCriteria.type",L"mailgun"); json.UpdateString(L"matchCriteria.integrationId",L"582dedf230e788746891281a"); json.UpdateBool(L"matchCriteria.primary",true); json.UpdateString(L"matchCriteria.address",L"steveb@channel5.com"); json.UpdateString(L"matchCriteria.subject",L"New message from {appName}"); json.UpdateString(L"confirmation.type",L"immediate"); json.UpdateString(L"confirmation.message.author.type",L"business"); json.UpdateString(L"confirmation.message.author.displayName",L"Steve"); json.UpdateString(L"confirmation.message.author.avatarUrl",L"https://www.gravatar.com/image.jpg"); json.UpdateString(L"confirmation.message.content.type",L"text"); json.UpdateString(L"confirmation.message.content.text",L"Hello!"); json.UpdateString(L"confirmation.message.metadata.lang",L"en-ca"); json.UpdateString(L"target.conversationId",L"029c31f25a21b47effd7be90"); resp->GetBodySb(sbResponseBody); jResp.LoadSb(sbResponseBody); jResp.put_EmitCompact(false);
}
Curl Command
curl -X POST
-u 'username:password'
-H "Content-Type: application/json"
-d '{
"matchCriteria": {
"type": "mailgun",
"integrationId": "582dedf230e788746891281a",
"primary": true,
"address": "steveb@channel5.com",
"subject": "New message from {appName}"
},
"confirmation": {
"type": "immediate",
"message": {
"author": {
"type": "business",
"displayName": "Steve",
"avatarUrl": "https://www.gravatar.com/image.jpg"
},
"content": {
"type": "text",
"text": "Hello!"
},
"metadata": {
"lang": "en-ca"
}
}
},
"target": {
"conversationId": "029c31f25a21b47effd7be90"
}
}'
https://domain.com/v2/apps/{{appId}}/users/:userIdOrExternalId/clients
Postman Collection Item JSON
{
"name": "Create Client",
"_postman_id": "e51d89dc-e2b1-4839-9eed-67dc8387cdaf",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"matchCriteria\": {\n \"type\": \"mailgun\",\n \"integrationId\": \"582dedf230e788746891281a\",\n \"primary\": true,\n \"address\": \"steveb@channel5.com\",\n \"subject\": \"New message from {appName}\"\n },\n \"confirmation\": {\n \"type\": \"immediate\",\n \"message\": {\n \"author\": {\n \"type\": \"business\",\n \"displayName\": \"Steve\",\n \"avatarUrl\": \"https://www.gravatar.com/image.jpg\"\n },\n \"content\": {\n \"type\": \"text\",\n \"text\": \"Hello!\"\n },\n \"metadata\": {\n \"lang\": \"en-ca\"\n }\n }\n },\n \"target\": {\n \"conversationId\": \"029c31f25a21b47effd7be90\"\n }\n}"
},
"url": {
"raw": "{{url}}/v2/apps/{{appId}}/users/:userIdOrExternalId/clients",
"host": [
"{{url}}"
],
"path": [
"v2",
"apps",
"{{appId}}",
"users",
":userIdOrExternalId",
"clients"
],
"variable": [
{
"key": "userIdOrExternalId"
}
]
},
"description": "Create a client and link it to a channel specified by the matchCriteria.type."
},
"response": [
{
"id": "74e580bd-67c5-486e-a95e-0e37794255b3",
"name": "Created",
"originalRequest": {
"method": "POST",
"header": [
{
"description": {
"content": "Added as a part of security scheme: bearer",
"type": "text/plain"
},
"key": "Authorization",
"value": "Bearer <token>"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"matchCriteria\": {\n \"type\": \"mailgun\",\n \"integrationId\": \"582dedf230e788746891281a\",\n \"primary\": true,\n \"address\": \"steveb@channel5.com\",\n \"subject\": \"New message from {appName}\"\n },\n \"confirmation\": {\n \"type\": \"immediate\",\n \"message\": {\n \"author\": {\n \"type\": \"business\",\n \"displayName\": \"Steve\",\n \"avatarUrl\": \"https://www.gravatar.com/image.jpg\"\n },\n \"content\": {\n \"type\": \"text\",\n \"text\": \"Hello!\"\n },\n \"metadata\": {\n \"lang\": \"en-ca\"\n }\n }\n },\n \"target\": {\n \"conversationId\": \"029c31f25a21b47effd7be90\"\n }\n}"
},
"url": {
"raw": "{{baseUrl}}/v2/apps/:appId/users/:userIdOrExternalId/clients",
"host": [
"{{baseUrl}}"
],
"path": [
"v2",
"apps",
":appId",
"users",
":userIdOrExternalId",
"clients"
],
"variable": [
{
"key": "appId"
},
{
"key": "userIdOrExternalId"
}
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"client\": {\n \"id\": \"5c9a34160c89726709136733\",\n \"type\": \"telegram\",\n \"status\": \"active\",\n \"integrationId\": \"582dedf230e788746891281a\",\n \"externalId\": \"your-own-id\",\n \"lastSeen\": \"2020-08-20T16:13:07.462Z\",\n \"linkedAt\": \"2020-06-23T14:33:47.492Z\",\n \"displayName\": \"Steve\",\n \"avatarUrl\": \"http://AKMiIDqXoOMCR.yuTZ,HeliL7IBkYuXRbpDPiRbgkrM.MhjHjbX2QqdToaIYNnnWYb8\",\n \"info\": {},\n \"raw\": {}\n }\n}"
}
]
}