CLSlackBundle
CLSlackBundle copied to clipboard
Unknown error (invalid_array_arg)
I'm trying use attachment, however, I can't.
I'm using this:
public function indexAction()
{
$payload = new ChatPostMessagePayload();
$payload->setChannel('#saopaulo-dev-qa'); // Channel names must begin with a hash-sign '#'
$attachment = new Attachment();
$attachment->setText('Test Text');
$attachment->setColor('good');
$attachment->setTitle('Teste Title');
$attachmentField = new AttachmentField();
$attachmentField->setTitle('Test Title Field');
$attachmentField->setValue('Test Value Field');
$attachment->addField($attachmentField);
$payload->addAttachment($attachment);
$response = $this->get('cl_slack.api_client')->send($payload,'xoxb-194306641143-i99KHJANwLCZTS84qpFR4G7z');
if ($response->isOk()) {
// do what you want...
} else {
echo sprintf('Something seemed to have gone wrong: %s', $response->getErrorExplanation());
}
}
and the response is that: Something seemed to have gone wrong: Unknown error (invalid_array_arg)
I not found in the documentation how to use an attachment, maybe I use badly. Anybody help me, please?