Question

How to get a Token ID from a Get request from a Webhook by Zapier

  • 3 January 2022
  • 6 replies
  • 283 views

I hace to send contact info to SAP, and for that was created a Webservice.

To be able to POST info into the platform previously I need to GET a Token ID.

And as I´m checking the webhook It only retrieves body data.

 

Is there a way obtain this information from the HEADER?

 


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @monitoreo_hauscom 

Change the Zap trigger to Webhook - Catch Raw Hook

 

Thanks Troy,

 

Probably I explained myself incorrectly.

 

The process is:

1- UNBOUNCE > Zapier Webhook

2- SAP Webservice (GET to obtain Token ID from HEADER): I´m having troubles in this part

3- Use the Token ID to POST to SAP Webservice: The Token ID is required to be able to send the contact information to SAP CRM.

 

 

This post has been edited by a moderator to remove sensitive information. Please remember to obfuscate any personally identifiable information prior to posting as this is a public forum. 

Userlevel 7
Badge +14

@monitoreo_hauscom 

Please provide the API documentation you are referencing for Step 2 to configure the GET Webhook request.

Sure Troy!

I needed to translate the documentation:

How to Solicit Token:

Do a GET to the Web Service sending through the HEADERS the following: 
+GET: https://--Removed by moderator--api.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRV;v=0004

+Basic Auth:
   +Type: Basic Auth
   +User Name: --Removed by moderator--
   +Password: --Removed by moderator--
   +HEADER:
        +Accept: application/json
        +Content-Type: multipart/mixed; boundary=batch
        +x-csrf-token: Fetch

+We will receive in the HEADER the Token Response:
    +Example: "x-csrf-token: --Removed by moderator--"

XC15To-p9rYfP5bT4C-OjTQo8fPdDMDC5HQHdeJH3jwBkDb_lux7d3q3ceXizNDecCerQL7ZDLhfTk25xlOCh5TD8rBWoM_XeeMaEGZVs_7Dg7YsIqYKlTlJb0_gusIVm309SeTJ

  1. Once received the token, we can consume the WS executing a POST.

Auth Data:

POST: https://--Removed by moderator--api.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CONTACT_SRV;v=0004/$batch

Type: Basic Auth

Username: --Removed by moderator--

Password: --Removed by moderator--

3xlDUHUnKVvX2veviki7kOHtHETVWEnPut9ol1mH5wjaYHQKRtxBbVdkA3bf3QjqWwDvLVvtXKv_ttBF40Pov3aw589FefeYk-54ruEJ5GBc542eLcujBUDsfA6vjqwKS_mx0MWf

Headers Data:

x-csrf-token: el token recibido en GET, ejemplo: --Removed by moderator--

Accept: application/json

Content-Type: multipart/mixed; boundary=batch

 

XC15To-p9rYfP5bT4C-OjTQo8fPdDMDC5HQHdeJH3jwBkDb_lux7d3q3ceXizNDecCerQL7ZDLhfTk25xlOCh5TD8rBWoM_XeeMaEGZVs_7Dg7YsIqYKlTlJb0_gusIVm309SeTJ

 

Body:

Example of registered user:

--batch

Content-Type: multipart/mixed; boundary=changeset_761e49b6-3146-4a57-8d10-15816fb9c75a

 

--changeset_761e49b6-3146-4a57-8d10-15816fb9c75a

content-type: application/http

content-transfer-encoding: binary

 

PUT ContactOriginData(ContactID='prueba_postman@gmail9.com',ContactOrigin='UNBOUNCE_MKT_AR') HTTP/1.1

Content-Length: 1035

Accept: application/json

Sap-Cuan-RequestTimestamp: '2021-12-21T13:13:47'

Sap-Cuan-SourceSystemType: ""

Sap-Cuan-SourceSystemId: ""

Content-Type: application/json

 

{

"OriginDataLastChgUTCDateTime" : "2021-12-21T13:13:47Z",

"Country" : "AR",

"AddressRegion" : "01",

"CityName" : "Postman 9",

"StreetName" : "Hauptstrasse",

"AddressHouseNumber" : "1",

"ContactPostalCode" : "24105",

"FirstName" : "Postman 9",

 "LastName" : "Postman 9",

 "FullName" : "Postman 9 Postman 9",

 "BirthDate":"1961-09-28T00:00:00",

 "GenderCode" : "1",

 "IsConsumer" : false,

 "IsContactPerson" : true,

 "Language" : "ES",

 "MaritalStatus" : "2",

 "IsObsolete" : false,

 "YY1_Profesion_ENH" : "Z010",

 "YY1_Especialidades_ENH" : "Ejemplo1",

 "YY1_EstadoPlan_ENH" : "Z10",

 "YY1_CantidadBovinoCria_ENH" : "7",

 "YY1_CantidadBovinoFeed_ENH" : "7",

 "YY1_CantidadBovinoTamb_ENH" : "7",

 "YY1_CantPorcinoxCerdas_ENH" : "7"

 }

 

--changeset_761e49b6-3146-4a57-8d10-15816fb9c75a

content-type: application/http

content-transfer-encoding: binary

 

PUT AdditionalIDs(ContactID='prueba_postman@gmail9.com',ContactOrigin='UNBOUNCE_MKT_AR',ContactAdditionalOrigin='EMAIL',ContactAdditionalID='prueba_postman@gmail9.com') HTTP/1.1

Content-Length: 1035

Accept: application/json

Sap-Cuan-RequestTimestamp: '2021-12-21T13:13:47'

Sap-Cuan-SourceSystemType: ""

Sap-Cuan-SourceSystemId: ""

Content-Type: application/json

 

{

}

 

--changeset_761e49b6-3146-4a57-8d10-15816fb9c75a--

--batch--

 

Field Details

 

Field

Description

Example

ContactID

El email del contacto

prueba_postman@gmail9.com

ContactOrigin

El origen de los contactos provenientes por landing page de Hauscom es: UNBOUNCE_MKT_AR

UNBOUNCE_MKT_AR

Content-Length

Por default siempre es: 1035

1035

Accept

Siempre va a ser: application/json

application/json

Sap-Cuan-RequestTimestamp

Marca de tiempo de la ejecución de la importación en este formato: AAAA-MM-DDTHH:MM:SS

2021-12-21T13:13:47

Sap-Cuan-SourceSystemType

Tipo de sistema fuente, lo dejamos en blanco

(en blanco)

Sap-Cuan-SourceSystemId

Identificador del sistema fuente, lo dejamos en blanco

(en blanco)

Content-Type: application/json

Formato del cuerpo. Siempre va a ser: application/json

application/json

OriginDataLastChgUTCDateTime

Marca de tiempo de la data de origen: AAAA-MM-DDTHH:MM:SSZ

2021-12-21T13:13:47Z

Country

Nombre del país, Argentina tiene el código ya propuesto: AR

AR

AddressRegion

Provincias de Argentina, denominado regiones en SAP, códigos de las regiones:

00 - Capital Federal

01 - Buenos Aires

02 - Catamarca

03 - Córdoba

04 - Corrientes

05 - Entre Ríos

06 - Jujuy

07 - Mendoza

08 - La Rioja

09 - Salta

10 - San Juan

11 - San Luís

12 - Santa Fe

13 - Santiago del Estero

14 - Tucumán

16 - Chaco

17 - Chubut

18 - Formosa

19 - Misiones

20 - Neuquén

21 - La Pampa

22 - Río Negro

23 - Santa Cruz

24 - Tierra del Fuego

01

CityName

Nombre de la localidad (denominada Población en SAP), es texto libre, es estándar

Postman 9

YY1_Localidad_ENH

Nombre de la localidad, por listado con códigos, si no excede las 4,000 localidades 

Compartir listado por HAUSCOM

StreetName

Nombre de la calle (dirección del contacto), texto libre

Hauptstrasse

AddressHouseNumber

Número exterior (dirección del contacto), numérico

1

ContactPostalCode

Código postal, numérico

24105

FirstName

Nombre del contacto, texto libre

Postman 9

LastName

Apellido del contacto, texto libre

Postman 9

FullName

Nombre completo del contacto, concatena FirstName y LastName

Postman 9 Postman 9

BirthDate

Fecha de nacimiento del contacto, formato: AAAA-MM-DDT00:00:00

1961-09-28T00:00:00

GenderCode

Género del contacto: 

1 - Masculino

2 - Femenino

1

IsConsumer

Es consumidor, dos opciones: 

TRUE - es consumidor

FALSE - no es consumidor

FALSE

IsContactPerson

Es contacto, dos opciones: 

TRUE - es contacto

FALSE - no es contacto

TRUE

Language

Idioma, ponemos ES (español)

ES

MaritalStatus

Estado civil: 

1 - Soltero 

2 - Casado

3 - Viudo

4 - Divorciado 

5 - Separado 

6 - Pareja de hecho

2

IsObsolete

Es obsoleto, dos opciones: 

TRUE - es obsoleto

FALSE - no es obsoleto

FALSE

YY1_Profesion_ENH

Profesión del contacto, opciones:

Z010 - Veterinario

Z020 - Ing. Agrónomo

Z030 - Zootecnista

Z040 - Lic en Marketing 

Z050 - Lic en RRHH 

Z060 - Abogado

Z070 - Ingeniero (Otro) 

Z080 - Auxiliar veterinario 

Z090 - Lic en Economía Agraria

Z100 - Economista

Z110 - Técnico Agropecuario

Z010

YY1_Especialidades_ENH

Especialidad del contacto, texto libre

Ejemplo1

YY1_EstadoPlan_ENH

Planes Estado, con opciones:

Z10 - Sin Seleccionar 

Z20 - No Corresponde

Z30 - Corresponde

Z40 - Pendientes

Z50 - Directos

Z10

YY1_CantidadBovinoCria_ENH

Cantidad de bovino cría, numérico

7

YY1_CantidadBovinoFeed_ENH

Cantidad de bovino feedlot, numérico

7

YY1_CantidadBovinoTamb_ENH

Cantidad de bovino tambo, numérico

7

YY1_CantPorcinoxCerdas_ENH

Cantidad de porcino por cerdas, numérico

7

 

Result:

Status: 202 Accepted
 

This post has been edited by a moderator to remove sensitive information. Please remember to not share any personally identifiable information when posting as this is a public forum. 

@Troy Tessalone Please, let me know if the documentation is ok. As I had to translate it from spanish some parts may be confusing.

 

Thank you!

Userlevel 7
Badge +9

@Troy Tessalone just calling you back into this thread to see if you have any recommendations for @monitoreo_hauscom!