<?php
use LcobucciJWTEncodingChainedFormatter;
use LcobucciJWTEncodingJoseEncoder;
use LcobucciJWTSignerKeyInMemory;
use LcobucciJWTSignerHmacSha256;
use LcobucciJWTTokenBuilder;
require 'vendor/autoload.php';
$tokenBuilder = new Builder(new JoseEncoder(), ChainedFormatter::default());
$algorithm = new Sha256();
$signingKey = InMemory::plainText("<SECRET_KEY>_GOES_HERE_REPLACING_THIS_TEXT");
$now = new DateTimeImmutable();
$token = $tokenBuilder
->withClaim('tokenType', 'app')
->issuedBy('<APP_ID>')
->expiresAt($now->modify('+30 seconds'))
->getToken($algorithm, $signingKey)
->toString();
echo $token;
curl --request PUT
--url https://api.talkjs.com/v1/APP_ID/
conversations/CONVERSATION_ID/messages/MESSAGE_ID
--header 'Authorization: Bearer YOUR_SECRET_KEY'
--header 'Content-Type: application/json'
--data '{
"text": "(Message removed by moderator)"
}We chose TalkJS because it aligned well with our usage, as we have a large number of users but low usage per user.