use CodeBuds\MattermostPublicationBundle\Model\Message as MMMessage;
use CodeBuds\MattermostPublicationBundle\MattermostPublication;
use Twig\Environment;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class MyController extends AbstractController
{
public function submitDonationForm(MattermostPublication $publication, Environment $twig)
{
$variable = "I am a variable";
try {
$mmMessage = (new MMMessage())
->setText($twig->render('mattermost/mymessage.md.twig', ['myVariable' => $variable]))
->setUsername('MyUsername')
->setChannel('MyChannel')
->setIconUrl('https://mysite.com/build/static/my_logo.webp')
->setWebhookUrl('http://otherwebhookurl');
$publication->publish($mmMessage);
} catch (\Exception $e) {
return $e->getMessage();
}
}
}
$publication->publish((new Message())
->setText("Hello John !")
->setChannel("@john"));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.