We need to update requests module so we can add Chats API support. Currently it's not possible even using raw amoCRM API requests.
Docs: amoCRM and Kommo
Required methods:
Required webhooks:
Required integration tokens, received from amoCRM when registering new Chats API integration:
- AMOJO_UUID
- AMOJO_BOT_UUID
- AMOJO_SECRET
Required account data:
- ACCOUNT_AMOJO_ID (received by /api/v4/account?with=amojo_id req)
- SCOPE_ID (consists of
${AMOJO_UUID}_${ACCOUNT_AMOJO_ID})
We also need to constuct complex headers using request body to work with chats API, example:
import { createHash } from "https://deno.land/std@0.91.0/hash/mod.ts";
import { hmac } from "https://deno.land/x/hmac@v2.0.1/mod.ts";
private getHeaders(body: object): Headers {
const contentType = "application/json";
const date = new Date().toUTCString().replace(
/(\w+), (\d+) (\w+) (\d+) (\d+):(\d+):(\d+) GMT/,
"$1, $2 $3 $4 $5:$6:$7 +0000",
);
const requestBody = JSON.stringify(body);
const checkSum = createHash("md5").update(requestBody).toString("hex");
const signature = hmac("sha1", AMOJO_SECRET, requestBody, "utf8", "hex").toString();
const headers = new Headers();
headers.append("Date", date);
headers.append("Content-Type", contentType);
headers.append("Content-MD5", checkSum);
headers.append("X-Signature", signature);
return headers;
}
Any help is appreciated
We need to update requests module so we can add Chats API support. Currently it's not possible even using raw amoCRM API requests.
Docs: amoCRM and Kommo
Required methods:
Required webhooks:
Required integration tokens, received from amoCRM when registering new Chats API integration:
Required account data:
${AMOJO_UUID}_${ACCOUNT_AMOJO_ID})We also need to constuct complex headers using request body to work with chats API, example:
Any help is appreciated