Search PHP Developer for Fileupload via Graphql API

My customer have the possibility to send an email to [example@domain.tld] and via the inbound parse from sendgrid i called a php file where generates a new item in monday and post new update for the created item.

This is all working fine. Now i also want to add the email attachments via api. I have no success.

Currently you got from sendgrid an array for attachments, where called via $_FILES. But the upload did not working.

1 Like

Hey @maximilian,
I’m Roberto of Omnidea, developer of General Caster app for
General Caster is based on PHP and features some integrations that upload files into columns and update.
Feel free to send me a DM or an email at with some details on your project.

hi @maximilian

Welcome to the community. About a year (or 2) ago I build this one in PHP. In my case the files itself are uploaded from my client device to my Wordpress server using WPForms file upload. On an event (button click) the function monday_upload_files is called. Not sure if this exactly meet your needs but maybe you can use it a a reference.

* Name:			monday_upload_files 
* Arguments:	$board_id, $upload - board_id: DOCS board id where item needs to be created / $upload: array with file upload information
* Returns:		None
* Function:		Creates an item in the given board (first group) and attaches the file to the file column

function monday_upload_files( $board_id, $upload) {

	//Create a new item in the board
	$header = array(
		'User-Agent' => MONDAY_TEAM . ' GraphQL Client',
		'Authorization' => get_field('mondaykey', 'user_' . get_current_user_id()),
		'Content-Type' => 'multipart/form-data' 

	//str_replace is used in an effort to get as close as possible to the original file name (sanitized by WPForms)
	$body = array(
		'query' => 'mutation {create_item (board_id: ' . $board_id . ', group_id: "topics", item_name: "' . str_replace("-"," ",pathinfo($upload['name'], PATHINFO_FILENAME)) . '") {id}}'

	$response = wp_remote_post( MONDAY_URL, ['headers' => $header, 'body' => $body] );
	$arr1 = json_decode($response['body'], true);
	$item_id = $arr1['data']['create_item']['id'];	

	//Generate a boundary, needed for the Header (Content-Type) and the Body (to split in multiple parts)
	$boundary = wp_generate_password(24);
	$eol = "\r\n";

	$header = array(
		'User-Agent' => MONDAY_TEAM . ' GraphQL Client',
		'Authorization' => get_field('mondaykey', 'user_' . get_current_user_id()),
		'Content-Type' => 'multipart/form-data; boundary=' . $boundary

	//We need to build the body from scratch because it is multipart with boundaries
	//Take care of the extra empty lines (twice $eol) before the actual query and file, otherwise an error 500 is returned

	$body = '--' . $boundary . $eol;
	$body .= 'Content-Disposition: form-data; name="query"' . $eol . $eol;
	$body .= 'mutation ($file: File!) {add_file_to_column (item_id: ' . $item_id . ', column_id: file, file: $file) {id}}' . $eol;
	$body .= '--' . $boundary . $eol;
	$body .= 'Content-Disposition: form-data; name="variables[file]"; filename="' . $upload['name'] . '"' . $eol;
	$body .= 'Content-Type: ' . $upload['type'] . $eol . $eol;
	$body .= file_get_contents($upload['value']);
	$body .= $eol . '--' . $boundary . '--';

	$response = wp_remote_post( MONDAY_URL . 'file/', ['headers' => $header, 'body' => $body] );

	unlink(ABSPATH . substr($upload['value'], 25));

Hi Rob,

thanks for your reply. I have send you an email with more details.

1 Like

Hi Maximilian,
What you are wanting done is well within my area of expertise and I would be happy to help you out on this.
You can reach me on
Best Wishes,

I’ve just replied to your email @maximilian