❓Q1: Pre-condition前置條件
您好🥰 您需要先註冊ChatDaddy,然後掃碼將您的WhatsApp與ChatDaddy連接起來,可查看下面的文檔: https://www.notion.so/chatdaddy/ChatDaddy-3mins-db45d699f21c4c44b8165a890c6df21e
❓Q2: How to generate token?如何生成token
Hi🥰, below is how to generate the token https://chatdaddy.stoplight.io/docs/openapi/b3A6MTUxMDc5NDM-login-to-chat-daddy Github地址: https://github.com/chatdaddy/typescript-client
We have two tokens-
access token:
short lived(1 hour at most) tokens used to access APIs
curl
refresh token:
long lived tokens used to generate access tokens
❓Q3: Access token generation sample示例
curl
curl --request POST \
--url https://api-teams.chatdaddy.tech/token \
--header 'Content-Type: application/json' \
--data '{"refreshToken":"d0d9d724-ec3f-4684-bdf5-65ae4f70df16","teamId":"1636bc4a-2122-4b06-8df7-d0d1e90bccf2","scopes":["MESSAGES_SEND_TO_ALL"]}'
PHP
<?php
$client = new http\Client;
$request = new http\Client\Request;
$body = new http\Message\Body;
$body->append('{"refreshToken":"d0d9d724-ec3f-4684-bdf5-65ae4f70df16","teamId":"1636bc4a-2122-4b06-8df7-d0d1e90bccf2","scopes":["MESSAGES_SEND_TO_ALL"]}');
$request->setRequestUrl('https://api-teams.chatdaddy.tech/token');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'Content-Type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
❓Q4: How to encode password 如何給密碼加密
您好🥰 關於如何encode password,請查看下面的文檔: https://www.notion.so/chatdaddy/How-to-encode-password-SHA256-base64-2cfba3f84cf845aaa052906752297992