• Przemek Zach
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
Hi I am building Salesforce app which authenticate users using oAuth2. When user complete authentication I am receiving access_token. When I use this token with REST API it works perfectly fine. When I try to use it with BULK API I get this error:
 
"{"exceptionCode":"InvalidSessionId","exceptionMessage":"Invalid session id"}"

The token must be valid because it works with REST API calls.
The user I am authenticating has "System administrator" profile selected and user license is "Salesforce". User has "Development Edition" so the API is enabled by default.
This is the code for creating BULK API job:
 
$job = createJob();

	var_dump($job);

	function createJob()
	{
		$accessToken = "mytokengoeshere";

		try {

			// Initializate Guzzle client
			$client   = new Client();

			// Request URI
			$request = $client->post("https://eu6.salesforce.com/services/async/37.0/job");

			## SET HEADERS

			// Add authentication token to the header
			$request->addHeader('X-SFDC-Session', $accessToken);
			// Set content type to JSON
			$request->addHeader('content-type', 'application/json');
			
			// Query data
			$data = json_encode(
						array("operation" 		=> "query",
						  	  "object" 			=> "Account",
						  	  "concurrencyMode" => "Parallel",
						      "contentType" 	=> "JSON")
					);			

			// Set body for Guzzle request
			$request->setBody($data);

			// Send the request and get the response
			$response = $request->send();

			// Convert response to JSON format
			$jsonResponse = $response->json();

			return $jsonResponse;

		} catch (ClientErrorResponseException $exception) {

			// Return exception message
			return $exception->getResponse()->getBody(true);

		}	
	}


This is the error message I get:

 
"{"exceptionCode":"InvalidSessionId","exceptionMessage":"Invalid session id"}"

The code is in PHP and it works perfectly fine when providing token for different salesforce developer account so I am assuming this is a problem with account setup on Salesforce.
I am attaching screenshots of my oauth app settings:


User-added image


User-added image





 
I understand that the question was not very clear, so I have rewritten it.

Imagine the situation.

1. Somebody makes a phone call on the number 01843668832.
2. The phone call goes through external company witch capture information such as caller telephone number, call lenght etc.
3. I pull stats from external company about this phone call using SOAP API.
4. Now I got this information and I am pushing it to SalesForce.
5. Salesforce receive this information and shows the pop up with received information to the agent.

My question is how do I achieve step 4 & 5?

Another thing is that I will need to do this for multiple Salesforce accounts. For example I will have 3 different accounts on SF.

Account A, Account B, Account C.

I will have have three different phone numbers:

number 123 - Belonging to Account A
number 456 - Belonging to Account B
number 789 - Belonging to Account C

I will have access to the phone call stats for all of these numbers.

I will get permission to access and change Account A, B & C Salesforce data using oAuth2 authentication.

When phone call happen to number 123 I want the pop up to show only for Account A.
When phone call happen to number 456 I want the pop up to show for Account B.
And so on.

Do I have to create Visual Force page or can that be places in standard Sales Force page (standard layout)?

Can this be achieved using Salesforce Open CTI ?
Hi,
I am new to Salesforce. I want to display a pop up window everytime someone makes a phone call. 
This would work like this:
1. Somebody makes a phone call
2. I capture this and send that information to Salesforce. 
3. Salesforce receive this information and open pop up window.

How can this be achieved? How can I tell Salesforce that there is a phone call? 

Can you please let me know what API  I need to use and give me some example?

Thanks in advance
Hi I am building Salesforce app which authenticate users using oAuth2. When user complete authentication I am receiving access_token. When I use this token with REST API it works perfectly fine. When I try to use it with BULK API I get this error:
 
"{"exceptionCode":"InvalidSessionId","exceptionMessage":"Invalid session id"}"

The token must be valid because it works with REST API calls.
The user I am authenticating has "System administrator" profile selected and user license is "Salesforce". User has "Development Edition" so the API is enabled by default.
This is the code for creating BULK API job:
 
$job = createJob();

	var_dump($job);

	function createJob()
	{
		$accessToken = "mytokengoeshere";

		try {

			// Initializate Guzzle client
			$client   = new Client();

			// Request URI
			$request = $client->post("https://eu6.salesforce.com/services/async/37.0/job");

			## SET HEADERS

			// Add authentication token to the header
			$request->addHeader('X-SFDC-Session', $accessToken);
			// Set content type to JSON
			$request->addHeader('content-type', 'application/json');
			
			// Query data
			$data = json_encode(
						array("operation" 		=> "query",
						  	  "object" 			=> "Account",
						  	  "concurrencyMode" => "Parallel",
						      "contentType" 	=> "JSON")
					);			

			// Set body for Guzzle request
			$request->setBody($data);

			// Send the request and get the response
			$response = $request->send();

			// Convert response to JSON format
			$jsonResponse = $response->json();

			return $jsonResponse;

		} catch (ClientErrorResponseException $exception) {

			// Return exception message
			return $exception->getResponse()->getBody(true);

		}	
	}


This is the error message I get:

 
"{"exceptionCode":"InvalidSessionId","exceptionMessage":"Invalid session id"}"

The code is in PHP and it works perfectly fine when providing token for different salesforce developer account so I am assuming this is a problem with account setup on Salesforce.
I am attaching screenshots of my oauth app settings:


User-added image


User-added image