Contact management

Contact management

Contacts

Introduction:

In this article we talk about API requests related to Contacts.
  • Create contact
  • Update contact
  • List and filter contacts


The endpoint we use is:https://app.hoteldatahub.io/api/v1/contacts/and the Swagger section is:https://app.hoteldatahub.io/swagger/#/contacts



Use cases:

The endpoint for contact management is very useful for incorporating new contacts into Fideltour from different sources. For existing contacts, it allows expanding the information contained in their profile, thus enriching the quality of the database. Multiple data sources can provide different information that is then centralized in Fideltour.

  1. Booking engine: The use of this endpoint from a booking engine allows retrieving the contact information of a guest who has made a reservation through the hotel or chain’s website. In this way, even before the guest arrives at the hotel, Fideltour already obtains their contact details and can use them to start communicating with the guest
  2. PMS: Information from a PMS is highly valuable for Fideltour, as many data sources centralize their information in it. It also allows us to obtain contact information for other guests besides the reservation holder, increasing the size of our database thanks to this connection.
  3. Wi-Fi and other platforms: In a hotel, there may be other platforms or cloud services that collect information about their users and can send it to Fideltour to enrich the database and improve marketing campaigns and informational communications about the hotel's services.


Available methods:

All the methods and filters available for working with contacts can be consulted here.

In this article we focus on the following:


  1. GET: Query of data from one or more contacts
  2. POST: Creating a new contact
  3. PATCH: Updating the data of an existing contact



Parameter table:


Field

Type

Obl.

Description

email

String

Yes

Contact email, single field, used as a contact identifier.

email_status

Integer

No No

Status of the email.

  • 0= New
  • 1= Valid
  • 2= Verified
  • 3= Bounced
  • 4= Hard bounced

custom_tags

List of Strings

No No

Two options:

  • Identifier of the label already created.
  • Name of the label. The system creates it if there is none with that name

phone1

String

No No

Contact telephone number

phone2

String

No No

Contact Phone 2

birthday

Date YYYY-MM-DD

No No

Date of birth

address address

String

No No

Address

post_code

String

No No

Postal code

gender

Integer

No No

Gender:

  • 0 = not specified (default)
  • 1 = man
  • 2 = woman
  • 3 =non-binary
  • 4 = gfluid
  • 5 = prefers not to say so

language language language

String

No No

province province

String

No No

Two options:

  • Identifier of the province already created.
  • Name of province. The system creates it if there is none with that name

town

String

No No

Two options:

  • Identifier of the city already created.
  • Name of the city. The system creates it if there is none with that name

zone zone

String

No No

Two options:

  • Identifier of the area already created.
  • Name of the area. The system creates it if there is none with that name

country country country

String

No No

name name

String

No No

Name of contact

surname

String

No No

Surnames of contact

source source

Integer

Yes

Origin of contact.

  • 0 = Pms
  • 1 = Wifi Login
  • 2 = Facebook
  • 3 = Web or Booking Engine
  • 4 = Other
  • 5 = Importation
  • 6 = Form Newsletter
  • 7 = Contact form
  • 8 = Guest Portal
  • 9 = Pre-Checkin
  • 10 = Chatbot
  • 11 = Concierge
  • 12 = Call Center

notes

String

No No

Notes

work_place

String

No No

Business position

business_name

String

No No

Name of company

business_address

String

No No

Company address

prosecutor_address

String

No No

Tax address

identification_document_type

Numeric

No No

Type of identity card.

  • 0= Other
  • 1= Id
  • 2= Nie
  • 3= Passport

identification_number

String

No No

Identity document number.

subscribed

Boolean

No No

Indicates whether the contact is subscribed to receive mailing.

  • True = Subscribed
  • False = Not subscribed (default)

is_active

Boolean

No No

Indicates whether the contact has been deleted from Fideltour's DB.

unsubscribe_reason

Integer

No No

Reason for subscription.

  • 1 = Incorrect email address
  • 2 = Own request (Contact)
  • 3 = Manager's request (Account)



Examples:

Here are some examples of creating, updating and viewing contacts.


Petition (POST-PATCH):

The following example shows a request to register (POST) or update (PATCH) the contactpablo@hdh.com.


Protocol: Http/1.1

Method: Post/Patch

Host/endpoint: https://app.hoteldatahub.io/api/v1/contacts/

Headers:

  • Content-type: application/json
  • Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

BODY: An example is added below.


  1. { {
  2. "email":"pablo@hdh.com",
  3. "email_status":0,
  4. "birthday":"1976-04-18",
  5. "phone1":"651442233",
  6. "phone2":"12323",
  7. "gender":2,
  8. "address":"Calle the olive trees",
  9. "province":"Madrid",
  10. "town":"Madrid",
  11. "zone":"Sun",
  12. "post_code":"28013",
  13. "language":"Es",
  14. "country":"Es",
  15. "name":"Pablo",
  16. "surname":"Look",
  17. "identification_document_type":1 1 1,
  18. "identification_number":"01234567Z",
  19. "source":1 1 1,
  20. "notes":"Very demanding",
  21. "work_place":"Palma",
  22. "bussiness_name":"Customia",
  23. "bussiness_address":"Street of industrial solutions 25",
  24. "Fiscal_address":"Street of industrial solutions 25",
  25. "custom_tags":[ [ [" VIP client","Tourist"],
  26. "subscribed":false,
  27. "is_active":true
  28. }

Note: true and false Boolean values can also be sent as Integers 1 and 0.


Answer (POST/PATCH):

In casa of a 200 or 201 response, JSON received has the following structure

  1. { {
  2. "id":9999999,
  3. "business_name":null,
  4. "work_place":"Madrid",
  5. "business_address":null,
  6. "Fiscal_address":"Street of industrial solutions 25",
  7. "language":"Es",
  8. "country":"Es",
  9. "created_at":"2022-01-01T12:12:12.654321",
  10. "level_name":"",
  11. "loyalty_card_number":null,
  12. "name":"Pablo",
  13. "surname":"Look",
  14. "email":"pablo@hdh.com",
  15. "email_status":0,
  16. "phone1":"651442233",
  17. "phone2":"12323",
  18. "gender":2,
  19. "identification_document_type":1 1 1,
  20. "identification_number":"01234567Z",
  21. "birthday":"1976-04-18",
  22. "address":"Calle the olive trees",
  23. "post_code":"07006",
  24. "source":1 1 1,
  25. "notes":"Very demanding",
  26. "photo":null,
  27. "subscribed":false,
  28. "unsubscribe_reason":null,
  29. "date_subscribed":"2022-01-01T12:12:12.654321",
  30. "modification_date_subscribed":null,
  31. "is_active":true,
  32. "points":0,
  33. "value":0,
  34. "review":null,
  35. "total_bookings":0,
  36. "level_points":0,
  37. "loyalty_custom_tag_timestamp":null,
  38. "is_profile_completed":false,
  39. "last_level_review":null,
  40. "kicked_out_loyalty":null,
  41. "province":1 1 1,
  42. "town":2,
  43. "zone":3,
  44. "level":null,
  45. "custom_tags":[ [ [4,5],
  46. "hotels":[]
  47. }



Request (GET):

The GET method allows the following:



Protocol: http/1.1

Method: get

Host/endpoint: https://app.hoteldatahub.io/api/v1/contacts/?email__iexact=pablo@hdh.com

Headers:

  • Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Body:In this case, as a GET-type method, we do not include data in the body of the request, as they are included in the URL.


Answer (GET):


  1. { {
  2. "count":1 1 1,
  3. "next":null,
  4. "previous":null,
  5. "results":[ [ [
  6. { {
  7. "id":7778735,
  8. "business_name":null,
  9. "work_place":"Palma",
  10. "business_address":null,
  11. "Fiscal_address":"Street of industrial solutions 25",
  12. "language":"Es",
  13. "country":"Es",
  14. "created_at":2022-12-21T16:40:20.681955",
  15. "level_name":"",
  16. "loyalty_card_number":null,
  17. "name":"Pablo",
  18. "surname":"Look",
  19. "email":"pablo@hdh.com",
  20. "email_status":0,
  21. "phone1":"651442233",
  22. "phone2":"12323",
  23. "gender":2,
  24. "identification_document_type":1 1 1,
  25. "identification_number":"01234567Z",
  26. "birthday":"1976-04-18",
  27. "address":"Calle the olive trees",
  28. "post_code":"07006",
  29. "source":1 1 1,
  30. "notes":"Very demanding",
  31. "photo":null,
  32. "subscribed":false,
  33. "unsubscribe_reason":null,
  34. "date_subscribed":2022-12-21T16:40:20.681955",
  35. "modification_date_subscribed":null,
  36. "is_active":true,
  37. "points":0,
  38. "value":0,
  39. "review":null,
  40. "total_bookings":0,
  41. "level_points":0,
  42. "loyalty_custom_tag_timestamp":null,
  43. "is_profile_completed":false,
  44. "last_level_review":null,
  45. "kicked_out_loyalty":null,
  46. "province":1 1 1,
  47. "town":2,
  48. "zone":3,
  49. "level":null,
  50. "custom_tags":[ [ [4,5],
  51. "hotels":[]
  52. }
  53. ]
  54. }
    • Related Articles

    • Motion management

      Movements Table of Contents Introduction Use cases Available methods Table of parameters Examples Petition (POST) Answer (POST) Petition (GET) Answer (GET) Petition (PATCH) Answer (PATCH) Introduction: In this article we talk about API requests ...
    • GDPR Consent

      GDPR Consent Introduction: In this article, we talk about API requests related to the mandatory consents of the General Data Protection Regulation (GDPR in English), and how to manage it in our contacts. - Create consents for a contact - List and ...
    • Loyalty

      Loyalty Introduction: In this article we talk about API requests related to the Fideltour Loyalty module. The sections of the Swagger which include this information are: https://app.hoteldatahub.io/swagger/#/contacts ...
    • Other connections

      Other Introduction In the Hotel Data Hub API, several numeric values are required, which serve to identify an item or element in Fideltour's database. We can deduce that if an item does not exist in the database, it must first be created in order to ...
    • Introduction

      Getting started Introduction: In this article, we show how to consult and use the HotelDataHub/Fideltour API through the Swagger platform. There, we find the different endpoints (URLs) and the information that must be provided for each one to use the ...